File tree Expand file tree Collapse file tree
src/FastExpressionCompiler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,18 +160,22 @@ public ref ExpressionNode NodeAt(Idx idx)
160160 }
161161
162162 // Packs NodeType + ChildIdx + ChildCount + ExtraIdx + ExtraCount into the 64-bit _data word.
163+ // ExpressionType max value is 83 (IsFalse), well within the 7-bit (0–127) field.
163164 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
164165 private static long PackData (
165166 ExpressionType nodeType ,
166167 short childIdx = 0 ,
167168 short childCount = 0 ,
168169 short extraIdx = 0 ,
169- byte extraCount = 0 ) =>
170- ( ( long ) ( int ) nodeType << 57 ) | // 7 bits at [63:57]
171- ( ( long ) ( ushort ) childIdx << 41 ) | // 16 bits at [56:41]
172- ( ( long ) ( ushort ) childCount << 25 ) | // 16 bits at [40:25]
173- ( ( long ) ( ushort ) extraIdx << 9 ) | // 16 bits at [24:9]
174- ( ( long ) extraCount << 1 ) ; // 8 bits at [8:1]
170+ byte extraCount = 0 )
171+ {
172+ Debug . Assert ( ( int ) nodeType >= 0 && ( int ) nodeType <= 127 , "ExpressionType must fit in 7 bits" ) ;
173+ return ( ( long ) nodeType << 57 ) | // 7 bits at [63:57] — ExpressionType max 83, fits in 7 bits
174+ ( ( long ) ( ushort ) childIdx << 41 ) | // 16 bits at [56:41]
175+ ( ( long ) ( ushort ) childCount << 25 ) | // 16 bits at [40:25]
176+ ( ( long ) ( ushort ) extraIdx << 9 ) | // 16 bits at [24:9]
177+ ( ( long ) extraCount << 1 ) ; // 8 bits at [8:1]
178+ }
175179
176180 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
177181 private Idx AddNode (
You can’t perform that action at this time.
0 commit comments