Skip to content

Commit

Permalink
chore: document potential unsoundness in indices
Browse files Browse the repository at this point in the history
  • Loading branch information
wucke13 committed Jun 27, 2024
1 parent 5a86518 commit 169f0f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/indices.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// /// This macro defines index types. Currently (2024-06-10) all indices are [`u32`].
// /// See <https://webassembly.github.io/spec/core/binary/modules.html#indices> for more information.
// macro_rules! def_idx_types {
// ($($name:ident),*) => {
// $(
Expand All @@ -10,6 +12,9 @@
// // #[allow(dead_code)]
// def_idx_types!(TypeIdx, FuncIdx, TableIdx, MemIdx, GlobalIdx, /* ElemIdx, DataIdx, */ LocalIdx/* , LabelIdx */);

// TODO check whether is is clever to internally use usize instead of u32; potential problems are:
// - unsound on architectures where `usize` < `u32`
// - wasteful in memory on architectures where `usize` > `u32`
pub type TypeIdx = usize;
pub type FuncIdx = usize;
pub type TableIdx = usize;
Expand Down

0 comments on commit 169f0f0

Please sign in to comment.