private void encodeGeneration ( CodeAssembler a , LocalVariable encodedVar , int offset , int generation ) { if ( offset < 0 ) { throw new IllegalArgumentException ( ) ; } if ( generation < 0 ) { return ; } if ( generation < 128 ) { a . loadLocal ( encodedVar ) ; a . loadConstant ( offset ) ; a . loadConstant ( ( byte ) generation ) ; a . storeToArray ( TypeDesc . BYTE ) ; } else { generation |= 0x80000000 ; for ( int i = 0 ; i < 4 ; i ++ ) { a . loadLocal ( encodedVar ) ; a . loadConstant ( offset + i ) ; a . loadConstant ( ( byte ) ( generation >> ( 8 * ( 3 - i ) ) ) ) ; a . storeToArray ( TypeDesc . BYTE ) ; } } }
Generates code that stores a one or four byte generation value into a byte array referenced by the local variable .