A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
int64x64.h
Go to the documentation of this file.
1 #ifndef INT64X64_H
2 #define INT64X64_H
3 
4 #include "ns3/core-config.h"
5 
6 // Order is important here, as it determines which implementation
7 // will generate doxygen API docs. This order mimics the
8 // selection logic in wscript, so we generate docs from the
9 // implementation actually chosen by the configuration.
10 #if defined (INT64X64_USE_128) && !defined (PYTHON_SCAN)
11 #include "int64x64-128.h"
12 #elif defined (INT64X64_USE_CAIRO) && !defined (PYTHON_SCAN)
13 #include "int64x64-cairo.h"
14 #elif defined (INT64X64_USE_DOUBLE) || defined (PYTHON_SCAN)
15 #include "int64x64-double.h"
16 #endif
17 
18 #include <iostream>
19 
20 namespace ns3 {
21 
94 inline
95 int64x64_t operator + (const int64x64_t & lhs, const int64x64_t & rhs)
96 {
97  int64x64_t tmp = lhs;
98  tmp += rhs;
99  return tmp;
100 }
105 inline
106 int64x64_t operator - (const int64x64_t & lhs, const int64x64_t & rhs)
107 {
108  int64x64_t tmp = lhs;
109  tmp -= rhs;
110  return tmp;
111 }
116 inline
117 int64x64_t operator * (const int64x64_t & lhs, const int64x64_t & rhs)
118 {
119  int64x64_t tmp = lhs;
120  tmp *= rhs;
121  return tmp;
122 }
127 inline
128 int64x64_t operator / (const int64x64_t & lhs, const int64x64_t & rhs)
129 {
130  int64x64_t tmp = lhs;
131  tmp /= rhs;
132  return tmp;
133 }
138 inline bool operator != (const int64x64_t & lhs, const int64x64_t & rhs)
139 {
140  return !(lhs == rhs);
141 }
146 inline bool operator <= (const int64x64_t & lhs, const int64x64_t & rhs)
147 {
148  return !(lhs > rhs);
149 }
154 inline bool operator >= (const int64x64_t & lhs, const int64x64_t & rhs)
155 {
156  return !(lhs < rhs);
157 }
172 std::ostream &operator << (std::ostream &os, const int64x64_t &val);
177 std::istream &operator >> (std::istream &is, int64x64_t &val);
178 
183 inline int64x64_t Abs (const int64x64_t &value)
184 {
185  return (value < 0) ? -value : value;
186 }
187 
194 inline int64x64_t Min (const int64x64_t &a, const int64x64_t &b)
195 {
196  return (a < b) ? a : b;
197 }
204 inline int64x64_t Max (const int64x64_t &a, const int64x64_t &b)
205 {
206  return (a > b) ? a : b;
207 }
208 
209 } // namespace ns3
210 
211 #endif /* INT64X64_H */
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:49
int64x64_t operator+(const int64x64_t &lhs)
Unary plus operator.
Definition: int64x64-128.h:381
High precision numerical type, implementing Q64.64 fixed precision.
Definition: int64x64-128.h:20
int64x64_t operator-(const int64x64_t &lhs)
Unary negation operator (change sign operator)
Definition: int64x64-128.h:389
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
Definition: int64x64.h:154
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
Definition: int64x64.h:146
int64x64_t operator*(const int64x64_t &lhs, const int64x64_t &rhs)
Multiplication operator.
Definition: int64x64.h:117
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition: int64x64.h:194
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
Definition: int64x64.h:204
int64x64_t operator/(const int64x64_t &lhs, const int64x64_t &rhs)
Division operator.
Definition: int64x64.h:128
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Definition: int64x64.h:183
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:43
bool operator!=(Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > a, Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 > b)
Inequality test.
Definition: callback.h:1217