Skip to content

Commit

Permalink
Adding support for MInt{128} (#1160)
Browse files Browse the repository at this point in the history
This PR extends our Machine Integers support to also support 128 bits
for k hashing and for equality function `==K`.
This is necessary for one of our light semantics in Pi2.
  • Loading branch information
Robertorosmaninho authored Oct 23, 2024
1 parent 7ab1dec commit f6b18d4
Show file tree
Hide file tree
Showing 6 changed files with 432 additions and 267 deletions.
6 changes: 6 additions & 0 deletions runtime/collections/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ void k_hash(block *arg, void *h) {
add_hash64(h, *intptr);
break;
}
case MINT_LAYOUT + 128: {
auto *intptr = (uint64_t *)(argintptr + offset);
add_hash64(h, intptr[0]);
add_hash64(h, intptr[1]);
break;
}
case MINT_LAYOUT + 160: {
auto *intptr = (uint64_t *)(argintptr + offset);
add_hash64(h, intptr[0]);
Expand Down
10 changes: 10 additions & 0 deletions runtime/collections/kelemle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ bool hook_KEQUAL_eq(block *arg1, block *arg2) {
}
break;
}
case MINT_LAYOUT + 128: {
auto *child1ptr = (int64_t *)(child1intptr);
auto *child2ptr = (int64_t *)(child2intptr);
bool cmp
= child1ptr[0] == child2ptr[0] && child1ptr[1] == child2ptr[1];
if (!cmp) {
return false;
}
break;
}
case MINT_LAYOUT + 160: {
auto *child1ptr = (int64_t *)(child1intptr);
auto *child2ptr = (int64_t *)(child2intptr);
Expand Down
Loading

0 comments on commit f6b18d4

Please sign in to comment.