-
-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clear garbage bits before cast short integer to float (#2813)
Co-authored-by: CountBleck <Mr.YouKnowWhoIAm@protonmail.com>
- Loading branch information
1 parent
dc547a8
commit 67579de
Showing
5 changed files
with
206 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
(module | ||
(type $0 (func)) | ||
(global $~lib/memory/__data_end i32 (i32.const 8)) | ||
(global $~lib/memory/__stack_pointer (mut i32) (i32.const 32776)) | ||
(global $~lib/memory/__heap_base i32 (i32.const 32776)) | ||
(memory $0 0) | ||
(table $0 1 1 funcref) | ||
(elem $0 (i32.const 1)) | ||
(export "memory" (memory $0)) | ||
(start $~start) | ||
(func $start:number-convert | ||
i32.const 1 | ||
f32.convert_i32_u | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 255 | ||
f32.convert_i32_u | ||
f32.const 255 | ||
f32.eq | ||
drop | ||
i32.const 256 | ||
i32.const 255 | ||
i32.and | ||
f32.convert_i32_u | ||
f32.const 0 | ||
f32.eq | ||
drop | ||
i32.const 257 | ||
i32.const 255 | ||
i32.and | ||
f32.convert_i32_u | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 1 | ||
f32.convert_i32_s | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 255 | ||
i32.extend8_s | ||
f32.convert_i32_s | ||
f32.const -1 | ||
f32.eq | ||
drop | ||
i32.const 256 | ||
i32.extend8_s | ||
f32.convert_i32_s | ||
f32.const 0 | ||
f32.eq | ||
drop | ||
i32.const 257 | ||
i32.extend8_s | ||
f32.convert_i32_s | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 1 | ||
f32.convert_i32_u | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 65535 | ||
f32.convert_i32_u | ||
f32.const 65535 | ||
f32.eq | ||
drop | ||
i32.const 65536 | ||
i32.const 65535 | ||
i32.and | ||
f32.convert_i32_u | ||
f32.const 0 | ||
f32.eq | ||
drop | ||
i32.const 65537 | ||
i32.const 65535 | ||
i32.and | ||
f32.convert_i32_u | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 1 | ||
f32.convert_i32_s | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 65535 | ||
i32.extend16_s | ||
f32.convert_i32_s | ||
f32.const -1 | ||
f32.eq | ||
drop | ||
i32.const 65536 | ||
i32.extend16_s | ||
f32.convert_i32_s | ||
f32.const 0 | ||
f32.eq | ||
drop | ||
i32.const 65537 | ||
i32.extend16_s | ||
f32.convert_i32_s | ||
f32.const 1 | ||
f32.eq | ||
drop | ||
i32.const 1 | ||
f64.convert_i32_u | ||
f64.const 1 | ||
f64.eq | ||
drop | ||
i32.const 255 | ||
f64.convert_i32_u | ||
f64.const 255 | ||
f64.eq | ||
drop | ||
i32.const 256 | ||
i32.const 255 | ||
i32.and | ||
f64.convert_i32_u | ||
f64.const 0 | ||
f64.eq | ||
drop | ||
i32.const 257 | ||
i32.const 255 | ||
i32.and | ||
f64.convert_i32_u | ||
f64.const 1 | ||
f64.eq | ||
drop | ||
i32.const 1 | ||
f64.convert_i32_s | ||
f64.const 1 | ||
f64.eq | ||
drop | ||
i32.const 255 | ||
i32.extend8_s | ||
f64.convert_i32_s | ||
f64.const -1 | ||
f64.eq | ||
drop | ||
i32.const 256 | ||
i32.extend8_s | ||
f64.convert_i32_s | ||
f64.const 0 | ||
f64.eq | ||
drop | ||
i32.const 257 | ||
i32.extend8_s | ||
f64.convert_i32_s | ||
f64.const 1 | ||
f64.eq | ||
drop | ||
) | ||
(func $~start | ||
call $start:number-convert | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"asc_flags": [ | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(module | ||
(memory $0 0) | ||
(export "memory" (memory $0)) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
assert(<f32><u8>(1) == 1); | ||
assert(<f32><u8>(255) == 255); | ||
assert(<f32><u8>(256) == 0); | ||
assert(<f32><u8>(257) == <f32>1); | ||
|
||
assert(<f32><i8>(1) == <f32>1); | ||
assert(<f32><i8>(255) == <f32>-1); | ||
assert(<f32><i8>(256) == <f32>0); | ||
assert(<f32><i8>(257) == <f32>1); | ||
|
||
assert(<f32><u16>(1) == <f32>1); | ||
assert(<f32><u16>(65535) == <f32>65535); | ||
assert(<f32><u16>(65536) == <f32>0); | ||
assert(<f32><u16>(65537) == <f32>1); | ||
|
||
assert(<f32><i16>(1) == <f32>1); | ||
assert(<f32><i16>(65535) == <f32>-1); | ||
assert(<f32><i16>(65536) == <f32>0); | ||
assert(<f32><i16>(65537) == <f32>1); | ||
|
||
assert(<f64><u8>(1) == <f64>1); | ||
assert(<f64><u8>(255) == <f64>255); | ||
assert(<f64><u8>(256) == <f64>0); | ||
assert(<f64><u8>(257) == <f64>1); | ||
|
||
assert(<f64><i8>(1) == <f64>1); | ||
assert(<f64><i8>(255) == <f64>-1); | ||
assert(<f64><i8>(256) == <f64>0); | ||
assert(<f64><i8>(257) == <f64>1); |