MCPcopy Create free account
hub / github.com/awslabs/llrt / shifted_bytes

Function shifted_bytes

modules/llrt_buffer/src/buffer.rs:812–826  ·  view source on GitHub ↗
(mut val: u64, bits: u8, endian: Endian)

Source from the content-addressed store, hash-verified

810 Value::new_int(ctx.clone(), value as i32)
811 },
812 NumberKind::Int32 => {
813 let value = match endian {
814 Endian::Big => i32::from_be_bytes(bytes.try_into().unwrap()),
815 Endian::Little => i32::from_le_bytes(bytes.try_into().unwrap()),
816 };
817 Value::new_int(ctx.clone(), value)
818 },
819 NumberKind::UInt32 => {
820 let value = match endian {
821 Endian::Big => u32::from_be_bytes(bytes.try_into().unwrap()),
822 Endian::Little => u32::from_le_bytes(bytes.try_into().unwrap()),
823 };
824 Value::new_float(ctx.clone(), value as f64)
825 },
826 };
827 Ok(value)
828}
829

Callers 1

write_bufFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected