/usr/include/ns3.27/ns3/int64x64.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2010 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef INT64X64_H
#define INT64X64_H
#include "ns3/core-config.h"
// Order is important here, as it determines which implementation
// will generate doxygen API docs. This order mimics the
// selection logic in wscript, so we generate docs from the
// implementation actually chosen by the configuration.
#if defined (INT64X64_USE_128) && !defined (PYTHON_SCAN)
#include "int64x64-128.h"
#elif defined (INT64X64_USE_CAIRO) && !defined (PYTHON_SCAN)
#include "int64x64-cairo.h"
#elif defined (INT64X64_USE_DOUBLE) || defined (PYTHON_SCAN)
#include "int64x64-double.h"
#endif
#include <iostream>
/**
* \file
* \ingroup highprec
* Declaration of the ns3::int64x64_t type and associated operators.
*/
namespace ns3 {
/**
* \ingroup core
* \defgroup highprec High Precision Q64.64
*
* Functions and class for high precision Q64.64 fixed point arithmetic.
*
* A Q64.64 fixed precision number consists of:
*
* Bits | Function
* ---- | --------
* 1 | Sign bit
* 63 | Integer portion
* 64 | Fractional portion
*
* The `high` word consists of the sign bit and integer value;
* the `low` word is the fractional part, unscaled.
*
* All standard arithmetic operations are supported:
*
* Category | Operators
* ----------- | ---------
* Computation | `+`, `+=`, `-`, `-=`, `*`, `*=`, `/`, `/=`
* Comparison | `==`, `!=`, `<`, `<=`, `>`, `>=`
* Unary | `+`, `-`, `!`
*/
/**
* \ingroup highprec
* \class int64x64_t
*
* High precision numerical type, implementing Q64.64 fixed precision.
*/
/**
* \ingroup highprec
* Addition operator.
*/
inline
int64x64_t operator + (const int64x64_t & lhs, const int64x64_t & rhs)
{
int64x64_t tmp = lhs;
tmp += rhs;
return tmp;
}
/**
* \ingroup highprec
* Subtraction operator.
*/
inline
int64x64_t operator - (const int64x64_t & lhs, const int64x64_t & rhs)
{
int64x64_t tmp = lhs;
tmp -= rhs;
return tmp;
}
/**
* \ingroup highprec
* Multiplication operator.
*/
inline
int64x64_t operator * (const int64x64_t & lhs, const int64x64_t & rhs)
{
int64x64_t tmp = lhs;
tmp *= rhs;
return tmp;
}
/**
* \ingroup highprec
* Division operator.
*/
inline
int64x64_t operator / (const int64x64_t & lhs, const int64x64_t & rhs)
{
int64x64_t tmp = lhs;
tmp /= rhs;
return tmp;
}
/**
* \ingroup highprec
* Inequality operator
*/
inline bool operator != (const int64x64_t & lhs, const int64x64_t & rhs)
{
return !(lhs == rhs);
}
/**
* \ingroup highprec
* Less or equal operator.
*/
inline bool operator <= (const int64x64_t & lhs, const int64x64_t & rhs)
{
return !(lhs > rhs);
}
/**
* \ingroup highprec
* Greater or equal operator.
*/
inline bool operator >= (const int64x64_t & lhs, const int64x64_t & rhs)
{
return !(lhs < rhs);
}
/**
* \ingroup highprec
* Output streamer for int64x64_t.
*
* Values are printed with the following format flags
* (independent of the stream flags):
* - `showpos`
* - `left`
*
* The stream `width` is ignored. If `floatfield` is set,
* `precision` decimal places are printed. If `floatfield` is not set,
* all digits of the fractional part are printed, up to the
* representation limit of 20 digits; trailing zeros are omitted.
*
* \param [in,out] os The output stream.
* \param [in] value The numerical value to print.
* \returns The stream.
*/
std::ostream &operator << (std::ostream &os, const int64x64_t &value);
/**
* \ingroup highprec
* Input streamer for int64x64_t.
*
* \param [in,out] is The input stream.
* \param [out] value The numerical value to set.
* \returns The stream.
*/
std::istream &operator >> (std::istream &is, int64x64_t &value);
/**
* \ingroup highprec
* Absolute value.
* \param [in] value The value to operate on.
* \return The absolute value of \p value.
*/
inline int64x64_t Abs (const int64x64_t &value)
{
return (value < 0) ? -value : value;
}
/**
* \ingroup highprec
* Minimum.
*
* \param [in] a The first value.
* \param [in] b The second value.
* \return The smaller of the arguments.
*/
inline int64x64_t Min (const int64x64_t &a, const int64x64_t &b)
{
return (a < b) ? a : b;
}
/**
* \ingroup highprec
* Maximum.
*
* \param [in] a The first value.
* \param [in] b The second value.
* \return The larger of the arguments.
*/
inline int64x64_t Max (const int64x64_t &a, const int64x64_t &b)
{
return (a > b) ? a : b;
}
} // namespace ns3
#endif /* INT64X64_H */
|