Skip to content

Add IU64 and Span classes, to compute spans over all integers - #9021

Merged
kripken merged 13 commits into
WebAssembly:mainfrom
kripken:i65_span
Aug 20, 2026
Merged

Add IU64 and Span classes, to compute spans over all integers#9021
kripken merged 13 commits into
WebAssembly:mainfrom
kripken:i65_span

Conversation

@kripken

@kripken kripken commented Aug 19, 2026

Copy link
Copy Markdown
Member

IU64 is a single numeric representation for both signed and unsigned
integers: it can contain as many negative values as a signed number can,
but also as many unsigned as well (so it needs more than 64 bits).

The Span class is a simple representation of contiguous Spans of numbers.

The next PR will use this internally in the Constraint system, to prove
things.

@kripken
kripken requested a review from tlively August 19, 2026 21:44
@kripken
kripken requested a review from a team as a code owner August 19, 2026 21:44
Comment thread src/support/span.h Outdated
Comment on lines +46 to +47
min = 1;
max = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well use min = Max; max = Min to avoid assuming that 0 and 1 can be converted to T.

Comment thread src/support/span.h Outdated
Comment on lines +52 to +56
static Span<T> empty() {
Span<T> ret;
ret.setEmpty();
return ret;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have empty return Span{...} and then have setEmpty() be implemented as *this = empty(), just to make the code more functional (and more consistent with setFull below). It probably doesn't make a difference in practice, though.

Comment thread src/support/span.h Outdated
Comment on lines +66 to +68
Span<T> ret;
ret.setFull();
return ret;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Span<T> ret;
ret.setFull();
return ret;
return Span{};

Comment thread src/support/span.h
Comment on lines +90 to +92
if (isEmpty()) {
return other.isEmpty();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just assume that empty spans have a single canonical representation and skip this check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose, though the risk is that someone constructs a non-canonical one manually. I think it's safer as is.

@kripken

kripken commented Aug 19, 2026

Copy link
Copy Markdown
Member Author

Thanks, feedback applied for the first 3 (and replied to the last).

@kripken
kripken merged commit 7836ed6 into WebAssembly:main Aug 20, 2026
16 checks passed
@kripken
kripken deleted the i65_span branch August 20, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants