forked from AssemblyScript/assemblyscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolyfills.ts
More file actions
25 lines (19 loc) 路 907 Bytes
/
Copy pathpolyfills.ts
File metadata and controls
25 lines (19 loc) 路 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// bswap / bswap16 tests
// check bswap<T> for i16/u16
assert(bswap<u16>(<u16>0xaabb) == <u16>0xbbaa);
assert(bswap<i16>(<i16>0xaabb) == <i16>0xbbaa);
// check bswap<T> for i32/u32
assert(bswap<u32>(<u32>0xaabbccdd) == <u32>0xddccbbaa);
assert(bswap<i32>(<i32>0xaabbccdd) == <i32>0xddccbbaa);
// check bswap<T> for i64/u64
assert(bswap<u64>(<u64>0x00112233aabbccdd) == <u64>0xddccbbaa33221100);
assert(bswap<i64>(<i64>0x00112233aabbccdd) == <i64>0xddccbbaa33221100);
// check bswap<T> for i32/u32
assert(bswap<usize>(<usize>0xaabbccdd) == <usize>0xddccbbaa);
assert(bswap<isize>(<isize>0xaabbccdd) == <isize>0xddccbbaa);
// check bswap16<T> for i16/u16
assert(bswap16<u16>(<u16>0xaabb) == <u16>0xbbaa);
assert(bswap16<i16>(<i16>0xaabb) == <i16>0xbbaa);
// check bswap16<T> for i32/u32
assert(bswap16<u32>(<u32>0xff88aabb) == <u32>0xff88bbaa);
assert(bswap16<i32>(<i32>0xff88aabb) == <i32>0xff88bbaa);