Skip to content

Commit d597c86

Browse files
committed
refactor: use constant packages, remove stdint
1 parent 343da6f commit d597c86

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

lib/node_modules/@stdlib/math/base/special/cos/include/stdlib/math/base/special/cos.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#ifndef STDLIB_MATH_BASE_SPECIAL_COS_H
2323
#define STDLIB_MATH_BASE_SPECIAL_COS_H
2424

25-
#include <stdint.h>
26-
2725
/*
2826
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
2927
*/

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,21 @@ var getHighWord = require( '@stdlib/number/float64/base/get-high-word' );
3838
var kernelCos = require( '@stdlib/math/base/special/kernel-cos' );
3939
var kernelSin = require( '@stdlib/math/base/special/kernel-sin' );
4040
var rempio2 = require( '@stdlib/math/base/special/rempio2' );
41+
var ABS_MASK = require( '@stdlib/constants/float64/high-word-abs-mask' );
42+
var EXPONENT_MASK = require( '@stdlib/constants/float64/high-word-exponent-mask' );
4143

4244

4345
// VARIABLES //
4446

4547
// Scratch array for storing temporary values:
4648
var buffer = [ 0.0, 0.0 ]; // WARNING: not thread safe
4749

48-
// High word absolute value mask: 0x7fffffff => 01111111111111111111111111111111
49-
var HIGH_WORD_ABS_MASK = 0x7fffffff|0; // asm type annotation
50-
5150
// High word of π/4: 0x3fe921fb => 00111111111010010010000111111011
5251
var HIGH_WORD_PIO4 = 0x3fe921fb|0; // asm type annotation
5352

5453
// High word of 2^-27: 0x3e400000 => 00111110010000000000000000000000
5554
var HIGH_WORD_TWO_NEG_27 = 0x3e400000|0; // asm type annotation
5655

57-
// High word exponent mask: 0x7ff00000 => 01111111111100000000000000000000
58-
var HIGH_WORD_EXPONENT_MASK = 0x7ff00000|0; // asm type annotation
59-
6056

6157
// MAIN //
6258

@@ -102,7 +98,7 @@ function cos( x ) {
10298
var n;
10399

104100
ix = getHighWord( x );
105-
ix &= HIGH_WORD_ABS_MASK;
101+
ix &= ABS_MASK;
106102

107103
// Case: |x| ~< pi/4
108104
if ( ix <= HIGH_WORD_PIO4 ) {
@@ -113,7 +109,7 @@ function cos( x ) {
113109
return kernelCos( x, 0.0 );
114110
}
115111
// Case: cos(Inf or NaN) is NaN */
116-
if ( ix >= HIGH_WORD_EXPONENT_MASK ) {
112+
if ( ix >= EXPONENT_MASK ) {
117113
return NaN;
118114
}
119115
// Case: Argument reduction needed...

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
"dependencies": [
3939
"@stdlib/math/base/napi/unary",
4040
"@stdlib/number/float64/base/get-high-word",
41+
"@stdlib/constants/float64/high-word-abs-mask",
42+
"@stdlib/constants/float64/high-word-exponent-mask",
4143
"@stdlib/math/base/special/kernel-cos",
4244
"@stdlib/math/base/special/kernel-sin",
4345
"@stdlib/math/base/special/rempio2"
@@ -55,6 +57,8 @@
5557
"libpath": [],
5658
"dependencies": [
5759
"@stdlib/number/float64/base/get-high-word",
60+
"@stdlib/constants/float64/high-word-abs-mask",
61+
"@stdlib/constants/float64/high-word-exponent-mask",
5862
"@stdlib/math/base/special/kernel-cos",
5963
"@stdlib/math/base/special/kernel-sin",
6064
"@stdlib/math/base/special/rempio2"
@@ -72,6 +76,8 @@
7276
"libpath": [],
7377
"dependencies": [
7478
"@stdlib/number/float64/base/get-high-word",
79+
"@stdlib/constants/float64/high-word-abs-mask",
80+
"@stdlib/constants/float64/high-word-exponent-mask",
7581
"@stdlib/math/base/special/kernel-cos",
7682
"@stdlib/math/base/special/kernel-sin",
7783
"@stdlib/math/base/special/rempio2"

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
#include "stdlib/math/base/special/cos.h"
3434
#include "stdlib/number/float64/base/get_high_word.h"
35+
#include "stdlib/constants/float64/high_word_abs_mask.h"
36+
#include "stdlib/constants/float64/high_word_exponent_mask.h"
3537
#include "stdlib/math/base/special/kernel_cos.h"
3638
#include "stdlib/math/base/special/kernel_sin.h"
3739
#include "stdlib/math/base/special/rempio2.h"
@@ -82,7 +84,7 @@ double stdlib_base_cos( const double x ) {
8284

8385
stdlib_base_float64_get_high_word( x, &uix );
8486
ix = (int32_t)uix;
85-
ix &= HIGH_WORD_ABS_MASK;
87+
ix &= STDLIB_CONSTANT_FLOAT64_HIGH_WORD_ABS_MASK;
8688

8789
// Case: |x| ~< π/4
8890
if ( ix <= HIGH_WORD_PIO4 ) {
@@ -93,7 +95,7 @@ double stdlib_base_cos( const double x ) {
9395
return stdlib_base_kernel_cos( x, 0.0 );
9496
}
9597
// Case: cos(Inf or NaN) is NaN */
96-
if ( ix >= HIGH_WORD_EXPONENT_MASK ) {
98+
if ( ix >= STDLIB_CONSTANT_FLOAT64_HIGH_WORD_EXPONENT_MASK ) {
9799
return 0.0 / 0.0; // NaN
98100
}
99101
// Case: Argument reduction needed...

0 commit comments

Comments
 (0)