Skip to content

Commit

Permalink
Improve consistency of JS_NewFloat64 API (#319)
Browse files Browse the repository at this point in the history
* Improve consistency of JS_NewFloat64 API

- `JS_NewFloat64()` always creates a `JS_TAG_FLOAT64` value
- internal `js_float64()` always creates a `JS_TAG_FLOAT64` value
- add `js_int64` internal function for consistency
- rename `float_is_int32` as `double_is_int32`
- handle `INT32_MIN` in `double_is_int32`, use (somewhat) faster alternative
- add `js_number(d)` to create a `JS_TAG_FLOAT64` or a `JS_TAG_INT` value
  if possible
- add `JS_NewNumber()` API for the same purpose
- use non testing constructor for infinities in `js_atof2`
- always store internal time value as a float64
- merge `JS_NewBigInt64_1` into `JS_NewBigInt64`
- use comparisons instead of `(int32_t)` casts (implementation defined behavior)
  • Loading branch information
chqrlie authored Mar 25, 2024
1 parent 18f2898 commit 3b50de4
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 81 deletions.
Loading

0 comments on commit 3b50de4

Please sign in to comment.