Sha256: 291eefa6b51c6d934ba2f4a4c9bc7c403046fc1cccf4d43487820f0154bb89e2

Contents?: true

Size: 1.47 KB

Versions: 41

Compression:

Stored size: 1.47 KB

Contents

#![allow(missing_docs)]

use crate::Format;
use test_assembler::{Label, Section};

pub trait GimliSectionMethods {
    fn sleb(self, val: i64) -> Self;
    fn uleb(self, val: u64) -> Self;
    fn initial_length(self, format: Format, length: &Label, start: &Label) -> Self;
    fn word(self, size: u8, val: u64) -> Self;
    fn word_label(self, size: u8, val: &Label) -> Self;
}

impl GimliSectionMethods for Section {
    fn sleb(mut self, mut val: i64) -> Self {
        while val & !0x3f != 0 && val | 0x3f != -1 {
            self = self.D8(val as u8 | 0x80);
            val >>= 7;
        }
        self.D8(val as u8 & 0x7f)
    }

    fn uleb(mut self, mut val: u64) -> Self {
        while val & !0x7f != 0 {
            self = self.D8(val as u8 | 0x80);
            val >>= 7;
        }
        self.D8(val as u8)
    }

    fn initial_length(self, format: Format, length: &Label, start: &Label) -> Self {
        match format {
            Format::Dwarf32 => self.D32(length).mark(start),
            Format::Dwarf64 => self.D32(0xffff_ffff).D64(length).mark(start),
        }
    }

    fn word(self, size: u8, val: u64) -> Self {
        match size {
            4 => self.D32(val as u32),
            8 => self.D64(val),
            _ => panic!("unsupported word size"),
        }
    }

    fn word_label(self, size: u8, val: &Label) -> Self {
        match size {
            4 => self.D32(val),
            8 => self.D64(val),
            _ => panic!("unsupported word size"),
        }
    }
}

Version data entries

41 entries across 38 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/gimli-0.31.1/src/test_util.rs
wasmtime-28.0.0 ./ext/cargo-vendor/gimli-0.31.1/src/test_util.rs
wasmtime-27.0.0 ./ext/cargo-vendor/gimli-0.31.1/src/test_util.rs
wasmtime-26.0.0 ./ext/cargo-vendor/gimli-0.31.1/src/test_util.rs
wasmtime-25.0.2 ./ext/cargo-vendor/gimli-0.29.0/src/test_util.rs
wasmtime-25.0.1 ./ext/cargo-vendor/gimli-0.29.0/src/test_util.rs
wasmtime-25.0.0 ./ext/cargo-vendor/gimli-0.29.0/src/test_util.rs
wasmtime-24.0.0 ./ext/cargo-vendor/gimli-0.29.0/src/test_util.rs
wasmtime-23.0.2 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-22.0.0 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-21.0.1 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-20.0.2 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-20.0.0 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-18.0.3 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-17.0.1 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-17.0.0 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-16.0.0 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-15.0.1 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-15.0.0 ./ext/cargo-vendor/gimli-0.28.1/src/test_util.rs
wasmtime-14.0.4 ./ext/cargo-vendor/gimli-0.28.0/src/test_util.rs