Skip to content

Commit 279c27d

Browse files
committed
fix: use in-house constant for significand mask
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 138713e commit 279c27d

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lib/node_modules/@stdlib/math/base/special/sinpif/lib/main.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ var FLOAT32_ABS_MASK = require( '@stdlib/constants/float32/abs-mask' );
4646
var FLOAT32_EXPONENT_MASK = require( '@stdlib/constants/float32/exponent-mask' );
4747
var FLOAT32_EXPONENT_BIAS = require( '@stdlib/constants/float32/exponent-bias' );
4848
var FLOAT32_NUM_SIGNIFICAND_BITS = require( '@stdlib/constants/float32/num-significand-bits' );
49+
var FLOAT32_SIGNIFICAND_MASK = require( '@stdlib/constants/float32/significand-mask' );
4950
var PI = require( '@stdlib/constants/float64/pi' );
5051

5152

@@ -76,9 +77,6 @@ var PI_LOW = f32( -8.90890988e-6 ); // 0xb715777a
7677
// Mask for extracting the high 16 bits of a 32-bit integer:
7778
var HIGH_16_MASK = 0xffff0000 >>> 0; // asm type annotation
7879

79-
// Mask for extracting the mantissa bits of a 32-bit float:
80-
var FLOAT32_MANTISSA_MASK = 0x007fffff >>> 0; // asm type annotation
81-
8280
// Mask for extracting the exponent bits of a 32-bit float:
8381
var FLOAT32_EXPONENT_FIELD_MASK = 0xff >>> 0; // asm type annotation
8482

@@ -128,7 +126,7 @@ function sinpif( x ) {
128126
var s;
129127

130128
x = f32( x );
131-
hx = toWordf( f32( x ) ) >>> 0; // asm type annotation
129+
hx = toWordf( f32( x ) );
132130
ix = (hx & FLOAT32_ABS_MASK) >>> 0; // asm type annotation
133131
ax = fromWordf( ix ); // asm type annotation
134132

@@ -166,7 +164,7 @@ function sinpif( x ) {
166164
if ( ix < LARGE_WORD ) {
167165
// Fast floor by bitwise manipulation:
168166
j0 = ( ( ix >> FLOAT32_NUM_SIGNIFICAND_BITS ) & FLOAT32_EXPONENT_FIELD_MASK ) - FLOAT32_EXPONENT_BIAS; // eslint-disable-line max-len
169-
ix &= ~( FLOAT32_MANTISSA_MASK >> j0 );
167+
ix &= ~( FLOAT32_SIGNIFICAND_MASK >> j0 );
170168
x = fromWordf( ix );
171169

172170
ax = f32( ax - x );

lib/node_modules/@stdlib/math/base/special/sinpif/manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"@stdlib/constants/float32/abs-mask",
4949
"@stdlib/constants/float32/sign-mask",
5050
"@stdlib/constants/float32/exponent-mask",
51+
"@stdlib/constants/float32/significand-mask",
5152
"@stdlib/constants/float32/num-significand-bits",
5253
"@stdlib/constants/float32/exponent-bias"
5354
]
@@ -74,6 +75,7 @@
7475
"@stdlib/constants/float32/abs-mask",
7576
"@stdlib/constants/float32/sign-mask",
7677
"@stdlib/constants/float32/exponent-mask",
78+
"@stdlib/constants/float32/significand-mask",
7779
"@stdlib/constants/float32/num-significand-bits",
7880
"@stdlib/constants/float32/exponent-bias"
7981
]
@@ -100,6 +102,7 @@
100102
"@stdlib/constants/float32/abs-mask",
101103
"@stdlib/constants/float32/sign-mask",
102104
"@stdlib/constants/float32/exponent-mask",
105+
"@stdlib/constants/float32/significand-mask",
103106
"@stdlib/constants/float32/num-significand-bits",
104107
"@stdlib/constants/float32/exponent-bias"
105108
]

lib/node_modules/@stdlib/math/base/special/sinpif/src/main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include "stdlib/constants/float32/abs_mask.h"
4141
#include "stdlib/constants/float32/sign_mask.h"
4242
#include "stdlib/constants/float32/exponent_mask.h"
43+
#include "stdlib/constants/float32/significand_mask.h"
4344
#include "stdlib/constants/float32/exponent_bias.h"
4445
#include "stdlib/constants/float32/num_significand_bits.h"
4546
#include <stdint.h>
@@ -69,9 +70,6 @@ static const float PI_LOW = -8.90890988e-6f; // 0xb715777a
6970
// Mask for extracting the high 16 bits of a 32-bit integer:
7071
static const uint32_t HIGH_16_MASK = 0xffff0000;
7172

72-
// Mask for extracting the mantissa bits of a 32-bit float:
73-
static const uint32_t FLOAT32_MANTISSA_MASK = 0x007fffff;
74-
7573
// Mask for extracting the exponent bits of a 32-bit float:
7674
static const uint32_t FLOAT32_EXPONENT_FIELD_MASK = 0xff;
7775

@@ -134,7 +132,7 @@ float stdlib_base_sinpif( const float x ) {
134132
if ( ix < LARGE_WORD ) {
135133
// Fast floor by bitwise manipulation:
136134
j0 = ( ( ix >> STDLIB_CONSTANT_FLOAT32_NUM_SIGNIFICAND_BITS ) & FLOAT32_EXPONENT_FIELD_MASK ) - STDLIB_CONSTANT_FLOAT32_EXPONENT_BIAS;
137-
ix &= ~( FLOAT32_MANTISSA_MASK >> j0 );
135+
ix &= ~( STDLIB_CONSTANT_FLOAT32_SIGNIFICAND_MASK >> j0 );
138136
stdlib_base_float32_from_word( ix, &fx );
139137

140138
ax -= fx;

0 commit comments

Comments
 (0)