Skip to content

Instantly share code, notes, and snippets.

View rmartinho's full-sized avatar

R. Martinho Fernandes rmartinho

View GitHub Profile
@rmartinho
rmartinho / bit_ops.cpp
Created April 24, 2013 22:44 — forked from bananu7/bit_ops.cpp
Bit twiddling tools. I got tired of primitive stuff like & and |
template <int Size>
struct uint_least : uint_least<Size+1> {};
template <>
struct uint_least<8> : identity<u8> {};
template <>
struct uint_least<16> : identity<u16> {};
template <>
struct uint_least<32> : identity<u32> {};
template <>
struct uint_least<64> : identity<u64> {};