ALPS Project: alps library

Header file bitops.h

This header contains bit operations modeled after Cray intrinsics. On Cray machines they are replaced by the intrinsic functions with the same name.

Synopsis

namespace alps {
template <class T, class N>
inline T gbit(T x, N n);

template <class T, class N>
inline T gbits(T x, N m, long n);

inline uint32_t maskr(uint16_t i);

inline uint32_t popcnt(uint32_t x);

}

Functions

template <class T, class N>
inline T gbit(T x, N n);
extracts the n-th bit from a word. On Cray hardware this template is replaced by the intrinsic function of the same name.
template <class T, class N>
inline T gbits(T x, N m, long n);
extracts m bits starting at position n. On Cray hardware this template is replaced by the intrinsic function of the same name.
inline uint32_t maskr(uint16_t i);
generates a 32-bit mask with the rightmost i bits set to 1. On Cray hardware this function is replaced by the 64-bit intrinsic function of the same name.
inline uint32_t popcnt(uint32_t x);
counts the number of 1-bits in a 32-bit integer. On Cray hardware this function is replaced by the 64-bit intrinsic function of the same name.

copyright (c) 1994-2010 by Matthias Troyer

Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt)