diff options
author | iximeow <me@iximeow.net> | 2024-06-23 17:49:32 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2024-06-23 17:49:32 -0700 |
commit | 8615380f9c23e7a4b7ce5dc997d36ae5dd1fa215 (patch) | |
tree | effebceb9acefece8bbe1e9a5feedb056dc12229 /src/display/display_sink/imp_generic.rs | |
parent | 3eba707a73c35ba93babdb74ac0f017afdd77974 (diff) |
make sure there are non-x86 alternatives for the x86 asm!
Diffstat (limited to 'src/display/display_sink/imp_generic.rs')
-rw-r--r-- | src/display/display_sink/imp_generic.rs | 26 |
1 files changed, 26 insertions, 0 deletions
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); +} |