public static void deconstructValue(byte[] ptr, int offset, long val, int size,
			boolean bigendian) {
		if (bigendian) {
			for (int i = size - 1; i >= 0; --i) {
				ptr[i + offset] = (byte) (val & 0xff);
				val >>= 8;
			}
		}
		else {
			for (int i = 0; i < size; ++i) {
				ptr[i + offset] = (byte) (val & 0xff);
				val >>= 8;
			}
		}
	}
This is a static convenience routine for encoding bytes from a given value, depending on
the desired endianness

@param ptr is a pointer to the location to write the encoded bytes
@param offset a fixed offset from {@code ptr} to where to write the bytes
@param val is the value to be encoded
@param size is the number of bytes to encode
@param bigendian is true if a big endian encoding is desired
Ghidra/Framework/Emulation/src/main/java/ghidra/pcode/memstate/MemoryBank.java