summaryrefslogtreecommitdiff
path: root/binparse/parse.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'binparse/parse.hpp')
-rw-r--r--binparse/parse.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/binparse/parse.hpp b/binparse/parse.hpp
index 2103177..e02b230 100644
--- a/binparse/parse.hpp
+++ b/binparse/parse.hpp
@@ -12,9 +12,15 @@
#include <array>
#include <vector>
#include <string>
+#include <cmath>
namespace binparse {
+template<typename T>
+constexpr bool bit(unsigned char bit, T const& t) {
+ return t & T(std::pow(2, bit));
+}
+
struct UnexpectedEOS : public std::runtime_error {
UnexpectedEOS();