Skip to content

Commit e0ae737

Browse files
committed
added some notes
1 parent abcff1a commit e0ae737

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
6262
- `int` has 32 bits, signed, so `int[]` transforms to `Int32Array`.
6363
- `char` has 2 bytes, so `char[]` transforms to `Uint16Array`.
6464
- `long` has 64 bit two's complement `integer`, can be signed or unsigned.
65+
- `float[]` can be ported to `Float32Array`.
66+
- `double[]` can be ported to `Float64Array`.
6567

6668
### JavaScript's TypedArray
6769

@@ -71,8 +73,8 @@ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
7173

7274
- Take care of `int` -> `number` (integer to number) port when doing bitwise transformation especially `<<`. Do a `& 0xFFFFFFFF` for ints, a &0xFF for bytes.
7375
- Take care of array initialization, in Java `new Array(N)` initializes capacity NOT size/length.
74-
- Use `Math.floor` for any division of ints otherwise the `number` type is a floating point and keeps the numbers after the dot.
75-
- For `float` to `int` casting use `Math.trunc`, to replicate the same effect as Java casting does.
76+
- Use `Math.floor` for any division of `int`s otherwise the `number` type is a floating point and keeps the numbers after the dot.
77+
- For `float`/`number` to `int` casting use `Math.trunc`, to replicate the same effect as Java casting does.
7678

7779
## Encoding
7880

0 commit comments

Comments
 (0)