Skip to content

Commit c0b3297

Browse files
committed
libm: rem_pio2: Reduce size of static array
This array was of 32-bit values, but the entries were only ever in the 0-255 range. Convert to uint8_t. Testing performed: The result of the sum-of-sin was unchanged >>> import math; sum(math.sin(2.**i) for i in range(21)) 1.42069
1 parent d3fb6c9 commit c0b3297

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/libm/ef_rem_pio2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
3636
*/
3737
#ifdef __STDC__
38-
static const __int32_t two_over_pi[] = {
38+
static const __uint8_t two_over_pi[] = {
3939
#else
40-
static __int32_t two_over_pi[] = {
40+
static __uint8_t two_over_pi[] = {
4141
#endif
4242
0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC,
4343
0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,

lib/libm/fdlibm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ extern float __ieee754_scalbf __P((float,float));
188188
extern float __kernel_sinf __P((float,float,int));
189189
extern float __kernel_cosf __P((float,float));
190190
extern float __kernel_tanf __P((float,float,int));
191-
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __int32_t*));
191+
extern int __kernel_rem_pio2f __P((float*,float*,int,int,int,const __uint8_t*));
192192

193193
/* A union which permits us to convert between a float and a 32 bit
194194
int. */

lib/libm/kf_rem_pio2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ two8 = 2.5600000000e+02, /* 0x43800000 */
6262
twon8 = 3.9062500000e-03; /* 0x3b800000 */
6363

6464
#ifdef __STDC__
65-
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __int32_t *ipio2)
65+
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const __uint8_t *ipio2)
6666
#else
6767
int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2)
68-
float x[], y[]; int e0,nx,prec; __int32_t ipio2[];
68+
float x[], y[]; int e0,nx,prec; __uint8_t ipio2[];
6969
#endif
7070
{
7171
__int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;

0 commit comments

Comments
 (0)