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 CMakeLists.txt, 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
45namespace ns3 {
46
88inline
90{
91 int64x64_t tmp = lhs;
92 tmp += rhs;
93 return tmp;
94}
102inline
104{
105 int64x64_t tmp = lhs;
106 tmp -= rhs;
107 return tmp;
108}
116inline
118{
119 int64x64_t tmp = lhs;
120 tmp *= rhs;
121 return tmp;
122}
130inline
132{
133 int64x64_t tmp = lhs;
134 tmp /= rhs;
135 return tmp;
136}
144inline bool operator != (const int64x64_t & lhs, const int64x64_t & rhs)
145{
146 return !(lhs == rhs);
147}
155inline bool operator <= (const int64x64_t & lhs, const int64x64_t & rhs)
156{
157 return !(lhs > rhs);
158}
166inline bool operator >= (const int64x64_t & lhs, const int64x64_t & rhs)
167{
168 return !(lhs < rhs);
169}
188std::ostream &operator << (std::ostream &os, const int64x64_t &value);
197std::istream &operator >> (std::istream &is, int64x64_t &value);
198
205inline int64x64_t Abs (const int64x64_t &value)
206{
207 return (value < 0) ? -value : value;
208}
209
218inline int64x64_t Min (const int64x64_t &a, const int64x64_t &b)
219{
220 return (a < b) ? a : b;
221}
230inline int64x64_t Max (const int64x64_t &a, const int64x64_t &b)
231{
232 return (a > b) ? a : b;
233}
234
235} // namespace ns3
236
237#endif /* INT64X64_H */
High precision numerical type, implementing Q64.64 fixed precision.
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
Definition: int64x64.h:230
int64x64_t operator/(const int64x64_t &lhs, const int64x64_t &rhs)
Division operator.
Definition: int64x64.h:131
bool operator>=(const int64x64_t &lhs, const int64x64_t &rhs)
Greater or equal operator.
Definition: int64x64.h:166
bool operator<=(const int64x64_t &lhs, const int64x64_t &rhs)
Less or equal operator.
Definition: int64x64.h:155
int64x64_t operator-(const int64x64_t &lhs, const int64x64_t &rhs)
Subtraction operator.
Definition: int64x64.h:103
int64x64_t operator+(const int64x64_t &lhs, const int64x64_t &rhs)
Addition operator.
Definition: int64x64.h:89
int64x64_t Abs(const int64x64_t &value)
Absolute value.
Definition: int64x64.h:205
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition: int64x64.h:218
int64x64_t operator*(const int64x64_t &lhs, const int64x64_t &rhs)
Multiplication operator.
Definition: int64x64.h:117
Declaration of the ns3::int64x64_t type using the Cairo implementation.
Declaration and implementation of the ns3::int64x64_t type using the double type.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:139
std::istream & operator>>(std::istream &is, Angles &a)
Definition: angles.cc:162
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:1612