Skip to content

Repository files navigation

BitFields

NuGet Package: https://www.nuget.org/packages/BitFields/

The analyzer in this package currently does not support packages.config format.

N-bit Ingeters

N-bit integers

Bit-field Generator

Type definition:

structRgb555{enumBitFields{B=5,G=5,R=5,}}

Quick Action:

Quick Action to generate bit-fields

Generated code:

usingBitFields;partialstructRgb555{publicushortValue;privateconstintBShift=0;privateconstushortBMask=unchecked((ushort)((1U<<5)-(1U<<0)));publicBit5B{get=>(Bit5)((Value&BMask)>>BShift);set=>Value=unchecked((ushort)((Value&~BMask)|((((ushort)value)<<BShift)&BMask)));}privateconstintGShift=5;privateconstushortGMask=unchecked((ushort)((1U<<10)-(1U<<5)));publicBit5G{get=>(Bit5)((Value&GMask)>>GShift);set=>Value=unchecked((ushort)((Value&~GMask)|((((ushort)value)<<GShift)&GMask)));}privateconstintRShift=10;privateconstushortRMask=unchecked((ushort)((1U<<15)-(1U<<10)));publicBit5R{get=>(Bit5)((Value&RMask)>>RShift);set=>Value=unchecked((ushort)((Value&~RMask)|((((ushort)value)<<RShift)&RMask)));}}

About

No description, website, or topics provided.

Resources

Stars

24 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages