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;
--- 55 unchanged lines hidden (view full) ---
64inline
65int64_t
66sext(uint64_t val)
67{
68 int sign_bit = bits(val, N-1, N-1);
69 return sign_bit ? (val | ~mask(N)) : val;
70}
71
72#endif // __BASE_BITFIELD_HH__
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;
--- 55 unchanged lines hidden (view full) ---
64inline
65int64_t
66sext(uint64_t val)
67{
68 int sign_bit = bits(val, N-1, N-1);
69 return sign_bit ? (val | ~mask(N)) : val;
70}
71
72#endif // __BASE_BITFIELD_HH__