pub unsafe fn BitUnPack(src: *const u8, dest: *mut u32, info: &BitUnpackInfo)
Expand description

0x10: Copy data from src to dest while increasing the bit depth of the elements copied.

  • This reads one byte at a time from src. Each source byte holds 1 or more source elements, depending on the source bit depth you specify. Elements within a byte are packed from low bit to high bit.
  • Each non-zero source element has the offset added to it. If the source element is zero and the “touch zero” flag is set, then that source element will also have the offset added to it. This creates a destination element.
  • Destination elements are collected into the output u32 buffer one at a time, from low bit to high bit. If a source element plus the offset produces a value larger than the destination element bit size this will corrupt any following destination elements within the buffer. When the buffer has 32 bits held then it’s written to the destination pointer.
  • When the source byte read has no more source elements remaining the source pointer will advance and src_byte_len will go down by 1. When src_byte_len goes to 0 the function’s main loop will break and return. If there was partial output in the u32 buffer when the function’s primary loop ends this data will be lost.

Safety

  • The info provided must correctly describe the data.
  • src must be readable for the number of bytes specified
  • dest must be writable for the number of words that the source buffer, source depth, and destination depth will total up to.
  • dest must be 4 byte aligned.