From 8615380f9c23e7a4b7ce5dc997d36ae5dd1fa215 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 23 Jun 2024 17:49:32 -0700 Subject: make sure there are non-x86 alternatives for the x86 asm! --- src/display/display_sink/imp_generic.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/display/display_sink/imp_generic.rs (limited to 'src/display/display_sink/imp_generic.rs') diff --git a/src/display/display_sink/imp_generic.rs b/src/display/display_sink/imp_generic.rs new file mode 100644 index 0000000..8819243 --- /dev/null +++ b/src/display/display_sink/imp_generic.rs @@ -0,0 +1,26 @@ +/// append `data` to `buf`, assuming `data` is less than 8 bytes and that `buf` has enough space +/// remaining to hold all bytes in `data`. +/// +/// Safety: callers must ensure that `buf.capacity() - buf.len() >= data.len()`. +#[inline(always)] +pub unsafe fn append_string_lt_8_unchecked(buf: &mut alloc::string::String, data: &str) { + buf.push_str(data); +} + +/// append `data` to `buf`, assuming `data` is less than 16 bytes and that `buf` has enough space +/// remaining to hold all bytes in `data`. +/// +/// Safety: callers must ensure that `buf.capacity() - buf.len() >= data.len()`. +#[inline(always)] +pub unsafe fn append_string_lt_16_unchecked(buf: &mut alloc::string::String, data: &str) { + buf.push_str(data); +} + +/// append `data` to `buf`, assuming `data` is less than 32 bytes and that `buf` has enough space +/// remaining to hold all bytes in `data`. +/// +/// Safety: callers must ensure that `buf.capacity() - buf.len() >= data.len()`. +#[inline(always)] +pub unsafe fn append_string_lt_32_unchecked(buf: &mut alloc::string::String, data: &str) { + buf.push_str(data); +} -- cgit v1.1