* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: BL_Types.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named 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.
* The above named 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 work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
typedef signed int int_t
;
typedef unsigned int uint_t
;
// Create a BL_Uint256 from 4 uint64_t. The first argument is the
// least significant uint64_t, the last argument the most
BL_Uint256(uint64_t _ls_val
, uint64_t _lms_val
,
uint64_t _mms_val
, uint64_t _ms_val
)
uint64_t get(uint_t ndx
) const { return array
[ndx
]; }
BL_Uint256
& set(uint_t ndx
, uint64_t val
)
BL_Uint256
& invert(uint_t bit
)
const uint_t nr_bits_in_ull
= sizeof(uint64_t) * 8;
uint_t array_ndx
= bit
/nr_bits_in_ull
;
fprintf(stderr
, "BL_Uint256::invert(): bad bit number: %d\n", bit
);
array
[array_ndx
] ^= (1ULL << (bit
%nr_bits_in_ull
));
BL_Uint256
operator&(const BL_Uint256
& op2
) const
for (uint_t ndx
= 0; ndx
< 4; ++ndx
)
result
.array
[ndx
] = array
[ndx
] & op2
.array
[ndx
];
#endif /* __BL_Types_h__ */