Changeset f4497c2 in mainline


Ignore:
Timestamp:
2024-04-17T20:46:04Z (2 weeks ago)
Author:
GitHub <noreply@…>
Parents:
522eecf (diff), e1fc596c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Maurizio Lombardi <m.lombardi85@…> (2024-04-17 20:46:04)
git-committer:
GitHub <noreply@…> (2024-04-17 20:46:04)
Message:

Merge e1fc596c2780d92d26b2da4c649020dc1b195174 into 522eecf2e7a8efe0c2e371007898fcb15dccdfa1

Location:
uspace/lib/math
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/math/generic/internal.h

    r522eecf rf4497c2  
    3131#define MATH_INTERNAL_H_
    3232
     33#include <stdint.h>
     34
     35#if __BE__
     36
     37typedef union
     38{
     39        double value;
     40        struct
     41        {
     42                uint32_t msw;
     43                uint32_t lsw;
     44        } parts;
     45        uint64_t word;
     46} ieee_double_shape_type;
     47
     48#endif
     49
     50#if __LE__
     51
     52typedef union
     53{
     54        double value;
     55        struct
     56        {
     57                uint32_t lsw;
     58                uint32_t msw;
     59        } parts;
     60        uint64_t word;
     61} ieee_double_shape_type;
     62
     63#endif
     64
     65#define EXTRACT_WORDS(ix0,ix1,d)                                \
     66do {                                                                \
     67  ieee_double_shape_type ew_u;                                        \
     68  ew_u.value = (d);                                                \
     69  (ix0) = ew_u.parts.msw;                                        \
     70  (ix1) = ew_u.parts.lsw;                                        \
     71} while (0)
     72
     73/* Get the more significant 32 bit int from a double.  */
     74#ifndef GET_HIGH_WORD
     75# define GET_HIGH_WORD(i,d)                                        \
     76do {                                                                \
     77  ieee_double_shape_type gh_u;                                        \
     78  gh_u.value = (d);                                                \
     79  (i) = gh_u.parts.msw;                                                \
     80} while (0)
     81#endif
     82
     83/* Get the less significant 32 bit int from a double.  */
     84#ifndef GET_LOW_WORD
     85# define GET_LOW_WORD(i,d)                                        \
     86do {                                                                \
     87  ieee_double_shape_type gl_u;                                        \
     88  gl_u.value = (d);                                                \
     89  (i) = gl_u.parts.lsw;                                                \
     90} while (0)
     91#endif
     92
     93/* Get all in one, efficient on 64-bit machines.  */
     94#ifndef EXTRACT_WORDS64
     95# define EXTRACT_WORDS64(i,d)                                        \
     96do {                                                                \
     97  ieee_double_shape_type gh_u;                                        \
     98  gh_u.value = (d);                                                \
     99  (i) = gh_u.word;                                                \
     100} while (0)
     101#endif
     102
     103/* Set a double from two 32 bit ints.  */
     104#ifndef INSERT_WORDS
     105# define INSERT_WORDS(d,ix0,ix1)                                \
     106do {                                                                \
     107  ieee_double_shape_type iw_u;                                        \
     108  iw_u.parts.msw = (ix0);                                        \
     109  iw_u.parts.lsw = (ix1);                                        \
     110  (d) = iw_u.value;                                                \
     111} while (0)
     112#endif
     113
     114/* Get all in one, efficient on 64-bit machines.  */
     115#ifndef INSERT_WORDS64
     116# define INSERT_WORDS64(d,i)                                        \
     117do {                                                                \
     118  ieee_double_shape_type iw_u;                                        \
     119  iw_u.word = (i);                                                \
     120  (d) = iw_u.value;                                                \
     121} while (0)
     122#endif
     123
     124/* Set the more significant 32 bits of a double from an int.  */
     125#ifndef SET_HIGH_WORD
     126#define SET_HIGH_WORD(d,v)                                        \
     127do {                                                                \
     128  ieee_double_shape_type sh_u;                                        \
     129  sh_u.value = (d);                                                \
     130  sh_u.parts.msw = (v);                                                \
     131  (d) = sh_u.value;                                                \
     132} while (0)
     133#endif
     134
     135/* Set the less significant 32 bits of a double from an int.  */
     136#ifndef SET_LOW_WORD
     137# define SET_LOW_WORD(d,v)                                        \
     138do {                                                                \
     139  ieee_double_shape_type sl_u;                                        \
     140  sl_u.value = (d);                                                \
     141  sl_u.parts.lsw = (v);                                                \
     142  (d) = sl_u.value;                                                \
     143} while (0)
     144#endif
     145
     146
    33147float __math_base_sin_32(float);
    34148float __math_base_cos_32(float);
  • uspace/lib/math/meson.build

    r522eecf rf4497c2  
    4444        'generic/sincos.c',
    4545        'generic/trunc.c',
     46        'generic/pow.c',
     47        'generic/scalbn.c',
     48        'generic/sqrt.c',
     49        'generic/log.c',
    4650)
    4751
Note: See TracChangeset for help on using the changeset viewer.