Blame view

build6/epsilon-master/liba/src/aeabi-rt/double.c 1.5 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  /* See the "Run-time ABI for the ARM Architecture", Section 4.1.2 */
  
  #include "float.h"
  
  // Conversions
  
  int __aeabi_d2iz(aeabi_double_t x) {
    return f64_to_i32_r_minMag(f64(x), 0);
  }
  
  aeabi_double_t __aeabi_i2d(int i) {
    return d(i32_to_f64(i));
  }
  
  aeabi_double_t __aeabi_ui2d(unsigned int i) {
    return d(ui32_to_f64(i));
  }
  
  aeabi_float_t __aeabi_d2f(aeabi_double_t d) {
    return f(f64_to_f32(f64(d)));
  }
  
  aeabi_double_t __aeabi_f2d(aeabi_float_t f) {
    return d(f32_to_f64(f32(f)));
  }
  
  // Comparisons
  
  int __aeabi_dcmpeq(aeabi_double_t a, aeabi_double_t b) {
    return f64_eq(f64(a), f64(b));
  }
  
  int __aeabi_dcmpge(aeabi_double_t a, aeabi_double_t b) {
    return f64_le(f64(b), f64(a));
  }
  
  int __aeabi_dcmpgt(aeabi_double_t a, aeabi_double_t b) {
    return f64_lt(f64(b), f64(a));
  }
  
  int __aeabi_dcmple(aeabi_double_t a, aeabi_double_t b) {
    return f64_le(f64(a), f64(b));
  }
  
  int __aeabi_dcmplt(aeabi_double_t a, aeabi_double_t b) {
    return f64_lt(f64(a), f64(b));
  }
  
  int __aeabi_dcmpun(aeabi_double_t a, aeabi_double_t b) {
    return !f64_eq(f64(a), f64(a)) || !f64_eq(f64(b), f64(b));
  }
  
  // Arithmetics
  
  aeabi_double_t __aeabi_dadd(aeabi_double_t a, aeabi_double_t b) {
    return d(f64_add(f64(a), f64(b)));
  }
  
  aeabi_double_t __aeabi_dsub(aeabi_double_t a, aeabi_double_t b) {
    return d(f64_sub(f64(a), f64(b)));
  }
  
  aeabi_double_t __aeabi_dmul(aeabi_double_t a, aeabi_double_t b) {
    return d(f64_mul(f64(a), f64(b)));
  }
  
  aeabi_double_t __aeabi_ddiv(aeabi_double_t a, aeabi_double_t b) {
    return d(f64_div(f64(a), f64(b)));
  }