diff options
author | Csaba Osztrogonác <oszi@inf.u-szeged.hu> | 2019-10-02 12:17:27 +0200 |
---|---|---|
committer | Dániel Bátyai <dbatyai@inf.u-szeged.hu> | 2019-10-02 12:17:27 +0200 |
commit | f5e3faeaff1dd318a5b5e6c7e9b158fac5d5052f (patch) | |
tree | 7519b3011ac2b11b9fde4c9387a0d31a895e0380 /jerry-core/include/jerryscript-snapshot.h | |
parent | 32962f067ef81498af07b454d67c5ef14b376f89 (diff) |
Make ecma_number_make_nan more optimal and C99 conform (#3163)
This change makes ecma_number_make_nan and ecma_number_make_infinity
always return constant value without any function call. Previously we
relied on compiler optimizations.
The ecma_number_t_accessor union is introduced to be able to access
float values as float and uint32_t (and doubles as double and uint64_t)
properly, without violating strict aliasing rules. There were many
copies of it, all of them were replaced to this new union.
Additionally ecma_number_make_nan should return QNaN instead of SNaN,
same value as C99 nan(""). Unfortunately calling nan("") here isn't
always optimal, because compilers sometimes generate constant returns,
sometimes function calls.
Before this change ecma_number_make_nan returned SNaN:
- double: 0x7FF0 0000 0000 0001 (sign:0, exponent: all 1 bits, fraction: 0...01)
- float: 0x7F8 00001 (sign:0, exponent: all 1 bits, fraction: 0...01)
After this change ecma_number_make_nan returns QNaN:
- double: 0x7FF8 0000 0000 0000 (sign:0, exponent: all 1 bits, fraction: 10..0)
- float: 0x7FC0 0000 (sign:0, exponent: all 1 bits, fraction: 10...0)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
Diffstat (limited to 'jerry-core/include/jerryscript-snapshot.h')
0 files changed, 0 insertions, 0 deletions