SystemC 3.0.0
Accellera SystemC proof-of-concept library
sc_uint_inlines.h
Go to the documentation of this file.
1/*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 implied. See the License for the specific language governing
16 permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22 sc_uint_inlines.h -- This file contains inline implementations that require
23 the other "int" headers to have been included before its
24 contents can be resolved.
25
26 Original Author: Andy Goodrich, Cadence Design Systems
27
28 *****************************************************************************/
29
30#ifndef SC_UINT_INLINES_H
31#define SC_UINT_INLINES_H
32
33namespace sc_dt {
34
35template<int W>
36template<int W1>
37inline
39{
40 if ( W1 < 33 ) {
41 m_val = (int)*source.digit;
42 }
43 else {
44 m_val = ( (int64)source.digit[1] << BITS_PER_DIGIT ) | *source.digit;
45 }
46 return *this;
47}
48
49template<int W>
50template<int W1>
51inline
53{
54 if ( W1 < 33 ) {
55 m_val = *source.digit;
56 }
57 else {
58 m_val = ( (uint64)source.digit[1] << BITS_PER_DIGIT ) | *source.digit;
59 }
60 return *this;
61}
62
63inline
66{
67 m_val = a.to_uint64();
68 extend_sign();
69 return *this;
70}
71
72inline
75{
76 m_val = a.to_uint64();
77 extend_sign();
78 return *this;
79}
80
81} // namespace sc_dt
82
83#endif // SC_UINT_INLINES_H
#define BITS_PER_DIGIT
Definition: sc_nbdefs.h:164
unsigned long long uint64
Definition: sc_nbdefs.h:216
long long int64
Definition: sc_nbdefs.h:215
uint64 to_uint64() const
Definition: sc_signed.h:1408
sc_digit * digit
Definition: sc_signed.h:1152
sc_uint< W > & operator=(uint_type v)
Definition: sc_uint.h:206
sc_uint_base & operator=(uint_type v)
Definition: sc_uint_base.h:590