mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Add inline directives to ensure unit placeholders are optimised away
This commit is contained in:
parent
d220ed7a23
commit
01b47a2ec7
2 changed files with 3 additions and 0 deletions
|
@ -578,6 +578,7 @@ struct SectionCounter {
|
|||
|
||||
impl SectionCounter {
|
||||
/// Update the section counter if buffer size increased since last call
|
||||
#[inline]
|
||||
fn update<SB: SerialBuffer>(&mut self, buffer: &mut SB) {
|
||||
let new_size = buffer.size();
|
||||
if new_size > self.buffer_size {
|
||||
|
@ -586,6 +587,7 @@ impl SectionCounter {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn serialize_and_count<SB: SerialBuffer, S: Serialize>(
|
||||
&mut self,
|
||||
buffer: &mut SB,
|
||||
|
|
|
@ -27,6 +27,7 @@ impl Serialize for u32 {
|
|||
|
||||
// Unit is used as a placeholder in parts of the Wasm spec we don't use yet
|
||||
impl Serialize for () {
|
||||
#[inline(always)]
|
||||
fn serialize<T: SerialBuffer>(&self, _buffer: &mut T) {}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue