1
- /* *
2
- * Copyright (c) 2014-present, Facebook, Inc.
1
+ /*
2
+ * Copyright (c) 2014-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the LICENSE
5
+ * file in the root directory of this source tree.
3
6
*
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
7
*/
7
-
8
8
#include " YGFloatOptional.h"
9
9
#include < cstdlib>
10
10
#include < iostream>
11
11
#include " Yoga.h"
12
12
13
- YGFloatOptional::YGFloatOptional (const float & value) {
13
+ YGFloatOptional::YGFloatOptional (float value) {
14
14
if (YGFloatIsUndefined (value)) {
15
15
isUndefined_ = true ;
16
16
value_ = 0 ;
@@ -31,18 +31,9 @@ const float& YGFloatOptional::getValue() const {
31
31
return value_;
32
32
}
33
33
34
- void YGFloatOptional::setValue (const float & val) {
35
- value_ = val;
36
- isUndefined_ = false ;
37
- }
38
-
39
- const bool & YGFloatOptional::isUndefined () const {
40
- return isUndefined_;
41
- }
42
-
43
34
bool YGFloatOptional::operator ==(const YGFloatOptional& op) const {
44
35
if (isUndefined_ == op.isUndefined ()) {
45
- return isUndefined_ ? true : value_ == op.getValue ();
36
+ return isUndefined_ || value_ == op.getValue ();
46
37
}
47
38
return false ;
48
39
}
@@ -51,14 +42,14 @@ bool YGFloatOptional::operator!=(const YGFloatOptional& op) const {
51
42
return !(*this == op);
52
43
}
53
44
54
- bool YGFloatOptional::operator ==(const float & val) const {
45
+ bool YGFloatOptional::operator ==(float val) const {
55
46
if (YGFloatIsUndefined (val) == isUndefined_) {
56
- return isUndefined_ ? true : val == value_;
47
+ return isUndefined_ || val == value_;
57
48
}
58
49
return false ;
59
50
}
60
51
61
- bool YGFloatOptional::operator !=(const float & val) const {
52
+ bool YGFloatOptional::operator !=(float val) const {
62
53
return !(*this == val);
63
54
}
64
55
@@ -84,9 +75,9 @@ bool YGFloatOptional::operator<(const YGFloatOptional& op) const {
84
75
}
85
76
86
77
bool YGFloatOptional::operator >=(const YGFloatOptional& op) const {
87
- return *this == op ? true : *this > op;
78
+ return *this == op || *this > op;
88
79
}
89
80
90
81
bool YGFloatOptional::operator <=(const YGFloatOptional& op) const {
91
- return *this == op ? true : *this < op;
82
+ return *this == op || *this < op;
92
83
}
0 commit comments