pdl: apply zero-padding correctly on the MSB side of the payload
Before we would always do the zero-padding after the payload. This is wrong for a big-endian encoding where we need to apply the padding to the left of the payload instead. As an example, consider a 24 bit field which is decoded into a 32 bit Rust value. In little-endian encoding, 3 bytes with values 0xC0 0xB0 0xA0 should be decoded to the integer 0xA0B0C0. Applying the padding after the bytes is correct here: 0xC0 0xB0 0xA0 0x00 is the little-endian encoding of 0xA0B0C0. For big-endian, the correct encoding is instead 0x00 0xA0 0xB0 0xC0 Bug: 239038416 Test: atest pdl_inline_tests Change-Id: I7b28dd99394fdfe4a78a47c453bd7a1e7a74cecb
Loading
Please register or sign in to comment