Skip to content

Make makeSetValue rounding consistent with HEAP64 semantics#19239

Merged
sbc100 merged 1 commit intomainfrom
makeSetValue_i64
Apr 24, 2023
Merged

Make makeSetValue rounding consistent with HEAP64 semantics#19239
sbc100 merged 1 commit intomainfrom
makeSetValue_i64

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Apr 24, 2023

This change does two things:

  1. Require 8 byte alignment for makeSetValue of i64. Natural alignment is already required for all other types in makeSetValue and I don't know of good reason not to require this also for i64. The comment here implied that perhaps i64 was not always 8 bytes aligned, perhaps in the fastcomp days. But with wasm32 and wasm64 i64 should always be 8 bytes aligned. Folks with unaligned data already cannot use makeGetValue/makeSetValue.

  2. Make splitI64 consistent with HEAP64 in the way it handles numbers that are outside the i64 range. i.e. truncation

Without the second part of the change the other.test_parseTools_bigint will fail because it will use HEAP64.set to set the value rather than splitI64, and HEAP64.set writes 0x2233445566780000 rather than 0xffffffff66780000.

The existing behaviour of splitI64 to write 0xffffffff66780000 seems rather odd since it seems to use saturation, but only for the upper half.

Loading
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