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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
| Fri Jan 26 18:49:20 CET 2018 Stephane Popinet <popinet@basilisk.fr>
* Added bool conversion operators
diff -rN -u old-cadna_c-2.0.2-basilisk/src/cadna_convert.cc new-cadna_c-2.0.2-basilisk/src/cadna_convert.cc
--- old-cadna_c-2.0.2-basilisk/src/cadna_convert.cc 2018-01-26 18:55:33.010599029 +0100
+++ new-cadna_c-2.0.2-basilisk/src/cadna_convert.cc 2018-01-26 18:55:33.034598788 +0100
@@ -567,6 +567,15 @@
}
return ((int)(x+y+z)/3.);
}
+double_st::operator bool(){
+ bool a;
+ if (_cadna_intrinsic_tag){
+ a=(bool)x;
+ if ((bool)y!=a || (bool)z!=a)
+ instability(&_cadna_intrinsic_count);
+ }
+ return ((bool)(x+y+z));
+}
double_st::operator unsigned short(){
unsigned short a;
if (_cadna_intrinsic_tag){
@@ -664,6 +673,15 @@
}
return ((int)(x+y+z)/3.);
}
+float_st::operator bool(){
+ bool a;
+ if (_cadna_intrinsic_tag){
+ a=(bool)x;
+ if ((bool)y!=a || (bool)z!=a)
+ instability(&_cadna_intrinsic_count);
+ }
+ return ((bool)(x+y+z));
+}
float_st::operator unsigned short(){
unsigned short a;
if (_cadna_intrinsic_tag){
@@ -778,6 +796,15 @@
}
return ((int)(x+y+z)/3.);
}
+double_st::operator bool() const{
+ bool a;
+ if (_cadna_intrinsic_tag){
+ a=(bool)x;
+ if ((bool)y!=a || (bool)z!=a)
+ instability(&_cadna_intrinsic_count);
+ }
+ return ((bool)(x+y+z));
+}
double_st::operator unsigned short() const{
unsigned short a;
if (_cadna_intrinsic_tag){
@@ -875,6 +902,15 @@
}
return ((int)(x+y+z)/3.);
}
+float_st::operator bool() const{
+ bool a;
+ if (_cadna_intrinsic_tag){
+ a=(bool)x;
+ if ((bool)y!=a || (bool)z!=a)
+ instability(&_cadna_intrinsic_count);
+ }
+ return ((bool)(x+y+z));
+}
float_st::operator unsigned short() const{
unsigned short a;
if (_cadna_intrinsic_tag){
diff -rN -u old-cadna_c-2.0.2-basilisk/src/cadna.h new-cadna_c-2.0.2-basilisk/src/cadna.h
--- old-cadna_c-2.0.2-basilisk/src/cadna.h 2018-01-26 18:55:33.010599029 +0100
+++ new-cadna_c-2.0.2-basilisk/src/cadna.h 2018-01-26 18:55:33.030598828 +0100
@@ -638,6 +638,7 @@
operator short();
operator unsigned short();
operator int();
+ operator bool();
operator unsigned int();
operator long();
operator unsigned long();
@@ -646,12 +647,12 @@
operator float();
operator double();
- operator float_st() const;
operator char() const;
operator unsigned char() const;
operator short() const;
operator unsigned short() const;
operator int() const;
+ operator bool() const;
operator unsigned int() const;
operator long() const;
operator unsigned long() const;
@@ -1394,6 +1395,7 @@
operator short();
operator unsigned short();
operator int();
+ operator bool();
operator unsigned();
operator long();
operator unsigned long();
@@ -1408,6 +1410,7 @@
operator short() const;
operator unsigned short() const;
operator int() const;
+ operator bool() const;
operator unsigned() const;
operator long() const;
operator unsigned long() const;
|