author | Nicola Baldo <nbaldo@cttc.es> |
Fri, 17 Jun 2011 17:32:20 +0200 | |
changeset 8148 | 09e2d03022a2 |
parent 7971 | 3cc205853837 |
child 8266 | 3a30a2b5c94c |
permissions | -rw-r--r-- |
7938 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
|
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 |
* Author: Manuel Requena <manuel.requena@cttc.es> |
|
7947 | 19 |
* Author: Marco Miozzo <marco.miozzo@cttc.es> |
7938 | 20 |
*/ |
21 |
||
22 |
#include "lte-common.h" |
|
7947 | 23 |
#include <ns3/log.h> |
7938 | 24 |
|
7947 | 25 |
NS_LOG_COMPONENT_DEFINE ("LteFfConverter"); |
7938 | 26 |
|
27 |
namespace ns3 { |
|
28 |
||
29 |
||
7971 | 30 |
LteFlowId_t::LteFlowId_t () |
7938 | 31 |
{ |
32 |
} |
|
33 |
||
7971 | 34 |
LteFlowId_t::LteFlowId_t (const uint16_t a, const uint8_t b) |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
35 |
: m_rnti (a), |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
36 |
m_lcId (b) |
7938 | 37 |
{ |
38 |
} |
|
39 |
||
40 |
bool |
|
7971 | 41 |
operator == (const LteFlowId_t &a, const LteFlowId_t &b) |
7938 | 42 |
{ |
43 |
return ( (a.m_rnti == b.m_rnti) && (a.m_lcId == b.m_lcId) ); |
|
44 |
} |
|
45 |
||
46 |
bool |
|
7971 | 47 |
operator < (const LteFlowId_t& a, const LteFlowId_t& b) |
7938 | 48 |
{ |
49 |
return ( (a.m_rnti < b.m_rnti) || ( (a.m_rnti == b.m_rnti) && (a.m_lcId < b.m_lcId) ) ); |
|
50 |
} |
|
51 |
||
52 |
||
7947 | 53 |
uint16_t |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
54 |
LteFfConverter::double2fpS11dot3 (double val) |
7947 | 55 |
{ |
56 |
// convert from double to fixed point notation Sxxxxxxxxxxx.xxx |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
57 |
int16_t valFp = (int16_t)(val * pow (2, 3)); |
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
58 |
return (valFp); |
7947 | 59 |
} |
60 |
||
61 |
double |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
62 |
LteFfConverter::fpS11dot3toDouble (uint16_t val) |
7947 | 63 |
{ |
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
64 |
// convert from fixed point notation Sxxxxxxxxxxx.xxx to double |
7947 | 65 |
double valD = ((int16_t)val) / pow (2, 3); |
66 |
return (valD); |
|
67 |
} |
|
68 |
||
69 |
double |
|
70 |
LteFfConverter::getMinFpS11dot3Value () |
|
71 |
{ |
|
8148
09e2d03022a2
run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents:
7971
diff
changeset
|
72 |
return (-4096); // -4096 = 0x8000 = 1000 0000 0000 0000 b |
7947 | 73 |
} |
74 |
||
75 |
//static double g_lowestFpS11dot3Value = -4096; // 0x8001 (1000 0000 0000 0000) |
|
76 |
||
77 |
||
78 |
||
7938 | 79 |
}; // namespace ns3 |
80 |