vb.netでビットフィールド構造体的アクセス

扱いたい数字の最高値をいれれば、いい感じに割り振ってくれる

dim data as int32

'元になるデータをセット
Dim dataBV As BitVector32 = New BitVector32( data )

'mySect1 はケツから0-6の数字が扱えるエリアと定義
'mySect2 はmySect1の次から0-3の数字が扱えるエリアと定義
'mySect3 はmySect2の次から0-1の数字が扱えるエリアと定義
'mySect4 はmySect3の次から0-15の数字が扱えるエリアと定義
dim mySect1 as BitVector32.Section = BitVector32.CreateSection( 6 )
dim mySect2 as BitVector32.Section = BitVector32.CreateSection( 3, mySect1 )
dim mySect3 as BitVector32.Section = BitVector32.CreateSection( 1, mySect2 )
dim mySect4 as BitVector32.Section = BitVector32.CreateSection( 15, mySect3 )

dim s1
s1 = dataBV(mySect1 )