A Discrete-Event Network Simulator
API
int64x64.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
20 #ifndef INT64X64_H
21 #define INT64X64_H
22 
23 #include "ns3/core-config.h"
24 
25 // Order is important here, as it determines which implementation
26 // will generate doxygen API docs. This order mimics the
27 // selection logic in wscript, so we generate docs from the
28 // implementation actually chosen by the configuration.
29 #if defined (INT64X64_USE_128) && !defined (PYTHON_SCAN)
30 #include "int64x64-128.h"
31 #elif defined (INT64X64_USE_CAIRO) && !defined (PYTHON_SCAN)
32 #include "int64x64-cairo.h"
33 #elif defined (INT64X64_USE_DOUBLE) || defined (PYTHON_SCAN)
34 #include "int64x64-double.h"
35 #endif
36 
37 #include <iostream>
38 
39 namespace ns3 {
40 
79 inline
80 int64x64_t operator + (const int64x64_t & lhs, const int64x64_t & rhs)
81 {
82  int64x64_t tmp = lhs;
83  tmp += rhs;
84  return tmp;
85 }
90 inline
91 int64x64_t operator - (const int64x64_t & lhs, const int64x64_t & rhs)
92 {
93  int64x64_t tmp = lhs;
94  tmp -= rhs;
95  return tmp;
96 }
101 inline
102 int64x64_t operator * (const int64x64_t & lhs, const int64x64_t & rhs)
103 {
104  int64x64_t tmp = lhs;
105  tmp *= rhs;
106  return tmp;
107 }
112 inline
113 int64x64_t operator / (const int64x64_t & lhs, const int64x64_t & rhs)
114 {
115  int64x64_t tmp = lhs;
116  tmp /= rhs;
117  return tmp;
118 }
123 inline bool operator != (const int64x64_t & lhs, const int64x64_t & rhs)
124 {
125  return !(lhs == rhs);
126 }
131 inline bool operator <= (const int64x64_t & lhs, const int64x64_t & rhs)
132 {
133  return !(lhs > rhs);
134 }
139 inline bool operator >= (const int64x64_t & lhs, const int64x64_t & rhs)
140 {
141  return !(lhs < rhs);
142 }
161 std::ostream &operator << (std::ostream &os, const int64x64_t &value);
170 std::istream &operator >> (std::istream &is, int64x64_t &value);
171 
178 inline int64x64_t Abs (const int64x64_t &value)
179 {
180  return (value < 0) ? -value : value;
181 }
182 
191 inline int64x64_t Min (const int64x64_t &a, const int64x64_t &b)
192 {
193  return (a < b) ? a : b;
194 }
203 inline int64x64_t Max (const int64x64_t &a, const int64x64_t &b)
204 {
205  return (a > b) ? a : b;
206 }
207 
208 } // namespace ns3
209 
210 #endif /* INT64X64_H */
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Definition: angles.cc:48
int64x64_t operator+(const int64x64_t &lhs)
Unary plus operator.
Definition: int64x64-128.h:404
High precision numerical type, implementing Q64.64 fixed precision.
Definition: int64x64-128.h:39
int64x64_t operator-(const int64x64_t &lhs)
Unary negation operator (change sign operator).
Definition: int64x64-128.h:412
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
Definition: int64x64.h:139
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
Definition: int64x64.h:131
int64x64_t operator*(const int64x64_t &lhs, const int64x64_t &rhs)
Multiplication operator.
Definition: int64x64.h:102
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition: int64x64.h:191
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
Definition: int64x64.h:203
int64x64_t operator/(const int64x64_t &lhs, const int64x64_t &rhs)
Division operator.
Definition: int64x64.h:113
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Definition: int64x64.h:178
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Definition: angles.cc:42
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:1272
Every class exported by the ns3 library is enclosed in the ns3 namespace.