LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 INRIA· | 3 * Copyright (c) 2010 INRIA· |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 */ | 18 */ |
19 | 19 |
20 #include "ns3/core-config.h" | 20 #include "ns3/core-config.h" |
21 #if !defined(INT64X64_CAIRO_H) && defined (INT64X64_USE_CAIRO) && !defined(PYTHO
N_SCAN) | 21 #if !defined(INT64X64_CAIRO_H) && defined (INT64X64_USE_CAIRO) && !defined(PYTHO
N_SCAN) |
22 #define INT64X64_CAIRO_H | 22 #define INT64X64_CAIRO_H |
23 | 23 |
24 #include <cmath> // pow | 24 #include <cmath> // pow |
25 | 25 |
26 #include "cairo-wideint-private.h" | 26 #include "cairo-wideint-private.h" |
27 | 27 |
| 28 #include "ns3/ns3-module.h" |
| 29 #define NS3_MODULE NS3_CORE_MODULE |
| 30 #include "ns3/ns3-export.h" |
| 31 |
28 /** | 32 /** |
29 * \file | 33 * \file |
30 * \ingroup highprec | 34 * \ingroup highprec |
31 * Declaration of the ns3::int64x64_t type using the Cairo implementation. | 35 * Declaration of the ns3::int64x64_t type using the Cairo implementation. |
32 */ | 36 */ |
33 | 37 |
34 namespace ns3 { | 38 namespace ns3 { |
35 | 39 |
36 /** | 40 /** |
37 * \internal | 41 * \internal |
38 * The implementation documented here uses cairo 128-bit integers. | 42 * The implementation documented here uses cairo 128-bit integers. |
39 */ | 43 */ |
40 class int64x64_t | 44 class NS3_EXPORT int64x64_t |
41 { | 45 { |
42 /// High bit of fractional part | 46 /// High bit of fractional part |
43 static const uint64_t HPCAIRO_MASK_HI_BIT = (((uint64_t)1)<<63); | 47 static const uint64_t HPCAIRO_MASK_HI_BIT = (((uint64_t)1)<<63); |
44 /// Mask for fraction part | 48 /// Mask for fraction part |
45 static const uint64_t HP_MASK_LO = 0xffffffffffffffffULL; | 49 static const uint64_t HP_MASK_LO = 0xffffffffffffffffULL; |
46 /** | 50 /** |
47 * Floating point value of HP_MASK_LO + 1 | 51 * Floating point value of HP_MASK_LO + 1 |
48 * We really want: | 52 * We really want: |
49 * \code | 53 * \code |
50 * static const long double HP_MAX_64 = std:pow (2.0L, 64); | 54 * static const long double HP_MAX_64 = std:pow (2.0L, 64); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 * MulByInvert() then completes the division. | 246 * MulByInvert() then completes the division. |
243 * | 247 * |
244 * (Really this should be a separate type representing Q0.128.) | 248 * (Really this should be a separate type representing Q0.128.) |
245 * | 249 * |
246 * \param [in] v The value to compute the inverse of. | 250 * \param [in] v The value to compute the inverse of. |
247 * \return A Q0.128 representation of the inverse. | 251 * \return A Q0.128 representation of the inverse. |
248 */ | 252 */ |
249 static int64x64_t Invert (const uint64_t v); | 253 static int64x64_t Invert (const uint64_t v); |
250 | 254 |
251 private: | 255 private: |
252 friend bool operator == (const int64x64_t & lhs, const int64x64_t & rh
s); | 256 friend NS3_EXPORT bool operator == (const int64x64_t & lhs, const int6
4x64_t & rhs); |
253 | 257 |
254 friend bool operator < (const int64x64_t & lhs, const int64x64_t & rh
s); | 258 friend NS3_EXPORT bool operator < (const int64x64_t & lhs, const int6
4x64_t & rhs); |
255 friend bool operator > (const int64x64_t & lhs, const int64x64_t & rh
s); | 259 friend NS3_EXPORT bool operator > (const int64x64_t & lhs, const int6
4x64_t & rhs); |
256 ·· | 260 ·· |
257 friend int64x64_t & operator += ( int64x64_t & lhs, const int64x64_t & rh
s); | 261 friend NS3_EXPORT int64x64_t & operator += ( int64x64_t & lhs, const int6
4x64_t & rhs); |
258 friend int64x64_t & operator -= ( int64x64_t & lhs, const int64x64_t & rh
s); | 262 friend NS3_EXPORT int64x64_t & operator -= ( int64x64_t & lhs, const int6
4x64_t & rhs); |
259 friend int64x64_t & operator *= ( int64x64_t & lhs, const int64x64_t & rh
s); | 263 friend NS3_EXPORT int64x64_t & operator *= ( int64x64_t & lhs, const int6
4x64_t & rhs); |
260 friend int64x64_t & operator /= ( int64x64_t & lhs, const int64x64_t & rh
s); | 264 friend NS3_EXPORT int64x64_t & operator /= ( int64x64_t & lhs, const int6
4x64_t & rhs); |
261 | 265 |
262 friend int64x64_t operator - (const int64x64_t & lhs); | 266 friend NS3_EXPORT int64x64_t operator - (const int64x64_t & lhs); |
263 friend int64x64_t operator ! (const int64x64_t & lhs); | 267 friend NS3_EXPORT int64x64_t operator ! (const int64x64_t & lhs); |
264 | 268 |
265 /** | 269 /** |
266 * Implement `*=`. | 270 * Implement `*=`. |
267 * | 271 * |
268 * \param [in] o The other factor. | 272 * \param [in] o The other factor. |
269 */··· | 273 */··· |
270 void Mul (const int64x64_t & o); | 274 void Mul (const int64x64_t & o); |
271 /** | 275 /** |
272 * Implement `/=`. | 276 * Implement `/=`. |
273 * | 277 * |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 */ | 413 */ |
410 inline int64x64_t operator ! (const int64x64_t & lhs) | 414 inline int64x64_t operator ! (const int64x64_t & lhs) |
411 { | 415 { |
412 return (lhs == int64x64_t ()) ? int64x64_t (1, 0) : int64x64_t (); | 416 return (lhs == int64x64_t ()) ? int64x64_t (1, 0) : int64x64_t (); |
413 } | 417 } |
414 | 418 |
415 | 419 |
416 } // namespace ns3 | 420 } // namespace ns3 |
417 | 421 |
418 #endif /* INT64X64_CAIRO_H */ | 422 #endif /* INT64X64_CAIRO_H */ |
LEFT | RIGHT |