Created
March 9, 2016 16:28
-
-
Save trondeau/41f6b77c44c03bc814bf to your computer and use it in GitHub Desktop.
Functions for building 64bit masks in gnuradio/math.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
/*! | |
* \param len length of the mask in bits up to 64. | |
* \returns A 64-bit mask aligned on the byte's MSB. | |
*/ | |
static inline uint64_t | |
create_64bit_msb_mask(unsigned len) | |
{ | |
return ((~0ULL) >> (64 - len)) << (64 - len); | |
} | |
/*! | |
* \param len length of the mask in bits up to 64. | |
* \returns A 64-bit mask aligned on the byte's LSB. | |
*/ | |
static inline uint64_t | |
create_64bit_lsb_mask(unsigned len) | |
{ | |
return ((~0ULL) >> (64 - len)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment