2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5/// Constructor from Identifier32
6inline Identifier::Identifier(const Identifier32& other)
8 if (other.is_valid()) {
9 m_id = (static_cast<value_type>(other.get_compact()) << 32);
13/// Constructor from Identifier32 value_type (unsigned int)
14/// (only use in id64 case since otherwise redundant)
15inline Identifier::Identifier(Identifier32::value_type value)
17 if (value == ~static_cast<Identifier32::value_type>(0)) {
20 m_id = (static_cast<value_type>(value) << 32);
24inline Identifier::Identifier(int value)
25 : m_id(static_cast<value_type>(value) << 32)
28//-----------------------------------------------
29inline Identifier::Identifier(value_type value)
31 const value_type upper = 0XFFFFFFFF00000000LL;
32 const value_type lower = 0X00000000FFFFFFFFLL;
33 const value_type testUpper = value & upper;
34 const value_type testLower = value & lower;
35 if (testUpper == 0 && testLower > 0) {
42Identifier::operator=(const Identifier32& old){
43 m_id = (static_cast<value_type>(old.get_compact()) << 32);
48Identifier::operator=(value_type value){
49 // I.e. if lower bits are set and no upper bit set
50 const value_type upper = 0XFFFFFFFF00000000LL;
51 const value_type lower = 0X00000000FFFFFFFFLL;
52 const value_type testUpper = value & upper;
53 const value_type testLower = value & lower;
54 if (testUpper == 0 && testLower > 0) {
63Identifier::operator=(Identifier32::value_type value){
64 if (value == ~static_cast<Identifier32::value_type>(0)) {
67 m_id = static_cast<value_type>(value) << 32;
73Identifier::operator=(int value){
74 m_id = static_cast<value_type>(value) << 32;
79Identifier::operator|=(value_type value){
85Identifier::operator&=(value_type value){
91Identifier::set_literal(value_type value){
101inline Identifier::value_type
102Identifier::extract(Identifier::size_type shift,
103 Identifier::size_type mask) const{
104 return (m_id >> shift) & static_cast<Identifier::value_type>(mask);
107inline Identifier::value_type
108Identifier::mask_shift(Identifier::value_type mask,
109 Identifier::size_type shift) const{
110 return (m_id & mask) >> shift;
113inline Identifier::value_type
114Identifier::extract(Identifier::size_type shift) const{
115 return (m_id >> shift);
119Identifier::get_identifier32() const{
120 // test for bit set in lower 32
121 if (extract(0, 0xFFFFFFFF)) return (Identifier32());
122 return (Identifier32(extract(32)));
125inline Identifier::value_type
126Identifier::get_compact() const{
132Identifier::operator==(Identifier::value_type other) const{
133 return (m_id == other);
137Identifier::operator==(Identifier32::value_type other) const{
138 return ((*this) == Identifier(other));
142Identifier::operator==(int other) const{
143 return ((*this) == Identifier(other));
148Identifier::is_valid() const{
149 return (!(max_value == m_id));