MCPcopy Create free account
hub / github.com/apache/fory / write_f32

Method write_f32

rust/fory-core/src/buffer.rs:391–401  ·  view source on GitHub ↗
(&mut self, value: f32)

Source from the content-addressed store, hash-verified

389
390 #[inline(always)]
391 pub fn write_f32(&mut self, value: f32) {
392 #[cfg(target_endian = "little")]
393 {
394 let bytes = unsafe { &*(&value as *const f32 as *const [u8; 4]) };
395 self.bf.extend_from_slice(bytes);
396 }
397 #[cfg(target_endian = "big")]
398 {
399 self.bf.extend_from_slice(&value.to_bits().to_le_bytes());
400 }
401 }
402
403 // ============ FLOAT16 (TypeId = 16) ============
404 #[inline(always)]

Callers 3

test_bufferFunction · 0.80
prepare_f32_bufferFunction · 0.80
bench_write_f32Function · 0.80

Calls 1

to_bitsMethod · 0.45

Tested by 1

test_bufferFunction · 0.64