119 |
/* NOTE: arm FPA is horrible as double 32 bit words are stored in big |
/* NOTE: arm FPA is horrible as double 32 bit words are stored in big |
120 |
endian ! */ |
endian ! */ |
121 |
typedef union { |
typedef union { |
122 |
double d; |
float64 d; |
123 |
#if defined(WORDS_BIGENDIAN) || (defined(__arm__) && !defined(__VFP_FP__)) |
#if defined(WORDS_BIGENDIAN) || (defined(__arm__) && !defined(__VFP_FP__)) |
124 |
struct { |
struct { |
125 |
uint32_t upper; |
uint32_t upper; |
268 |
|
|
269 |
/* float access */ |
/* float access */ |
270 |
|
|
271 |
static inline float ldfl_p(void *ptr) |
static inline float32 ldfl_p(void *ptr) |
272 |
{ |
{ |
273 |
union { |
union { |
274 |
float f; |
float32 f; |
275 |
uint32_t i; |
uint32_t i; |
276 |
} u; |
} u; |
277 |
u.i = ldl_p(ptr); |
u.i = ldl_p(ptr); |
278 |
return u.f; |
return u.f; |
279 |
} |
} |
280 |
|
|
281 |
static inline void stfl_p(void *ptr, float v) |
static inline void stfl_p(void *ptr, float32 v) |
282 |
{ |
{ |
283 |
union { |
union { |
284 |
float f; |
float32 f; |
285 |
uint32_t i; |
uint32_t i; |
286 |
} u; |
} u; |
287 |
u.f = v; |
u.f = v; |
288 |
stl_p(ptr, u.i); |
stl_p(ptr, u.i); |
289 |
} |
} |
290 |
|
|
291 |
static inline double ldfq_p(void *ptr) |
static inline float64 ldfq_p(void *ptr) |
292 |
{ |
{ |
293 |
CPU_DoubleU u; |
CPU_DoubleU u; |
294 |
u.l.lower = ldl_p(ptr); |
u.l.lower = ldl_p(ptr); |
296 |
return u.d; |
return u.d; |
297 |
} |
} |
298 |
|
|
299 |
static inline void stfq_p(void *ptr, double v) |
static inline void stfq_p(void *ptr, float64 v) |
300 |
{ |
{ |
301 |
CPU_DoubleU u; |
CPU_DoubleU u; |
302 |
u.d = v; |
u.d = v; |
397 |
|
|
398 |
/* float access */ |
/* float access */ |
399 |
|
|
400 |
static inline float ldfl_p(void *ptr) |
static inline float32 ldfl_p(void *ptr) |
401 |
{ |
{ |
402 |
union { |
union { |
403 |
float f; |
float32 f; |
404 |
uint32_t i; |
uint32_t i; |
405 |
} u; |
} u; |
406 |
u.i = ldl_p(ptr); |
u.i = ldl_p(ptr); |
407 |
return u.f; |
return u.f; |
408 |
} |
} |
409 |
|
|
410 |
static inline void stfl_p(void *ptr, float v) |
static inline void stfl_p(void *ptr, float32 v) |
411 |
{ |
{ |
412 |
union { |
union { |
413 |
float f; |
float32 f; |
414 |
uint32_t i; |
uint32_t i; |
415 |
} u; |
} u; |
416 |
u.f = v; |
u.f = v; |
417 |
stl_p(ptr, u.i); |
stl_p(ptr, u.i); |
418 |
} |
} |
419 |
|
|
420 |
static inline double ldfq_p(void *ptr) |
static inline float64 ldfq_p(void *ptr) |
421 |
{ |
{ |
422 |
CPU_DoubleU u; |
CPU_DoubleU u; |
423 |
u.l.upper = ldl_p(ptr); |
u.l.upper = ldl_p(ptr); |
425 |
return u.d; |
return u.d; |
426 |
} |
} |
427 |
|
|
428 |
static inline void stfq_p(void *ptr, double v) |
static inline void stfq_p(void *ptr, float64 v) |
429 |
{ |
{ |
430 |
CPU_DoubleU u; |
CPU_DoubleU u; |
431 |
u.d = v; |
u.d = v; |
472 |
|
|
473 |
/* float access */ |
/* float access */ |
474 |
|
|
475 |
static inline float ldfl_p(void *ptr) |
static inline float32 ldfl_p(void *ptr) |
476 |
{ |
{ |
477 |
return *(float *)ptr; |
return *(float32 *)ptr; |
478 |
} |
} |
479 |
|
|
480 |
static inline double ldfq_p(void *ptr) |
static inline float64 ldfq_p(void *ptr) |
481 |
{ |
{ |
482 |
return *(double *)ptr; |
return *(float64 *)ptr; |
483 |
} |
} |
484 |
|
|
485 |
static inline void stfl_p(void *ptr, float v) |
static inline void stfl_p(void *ptr, float32 v) |
486 |
{ |
{ |
487 |
*(float *)ptr = v; |
*(float32 *)ptr = v; |
488 |
} |
} |
489 |
|
|
490 |
static inline void stfq_p(void *ptr, double v) |
static inline void stfq_p(void *ptr, float64 v) |
491 |
{ |
{ |
492 |
*(double *)ptr = v; |
*(float64 *)ptr = v; |
493 |
} |
} |
494 |
#endif |
#endif |
495 |
|
|