Deleted Added
sdiff udiff text old ( 3814:33bd4ec9d66a ) new ( 4070:74449a198a44 )
full compact
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 30 unchanged lines hidden (view full) ---

39 */
40inline uint64_t
41mask(int nbits)
42{
43 return (nbits == 64) ? (uint64_t)-1LL : (1ULL << nbits) - 1;
44}
45
46
47/**
48 * Extract the bitfield from position 'first' to 'last' (inclusive)
49 * from 'val' and right justify it. MSB is numbered 63, LSB is 0.
50 */
51template <class T>
52inline
53T
54bits(T val, int first, int last)

--- 9 unchanged lines hidden (view full) ---

64template <class T>
65inline
66T
67mbits(T val, int first, int last)
68{
69 return val & (mask(first+1) & ~mask(last));
70}
71
72/**
73 * Sign-extend an N-bit value to 64 bits.
74 */
75template <int N>
76inline
77int64_t
78sext(uint64_t val)
79{

--- 29 unchanged lines hidden ---