From be17b06a2f243faffd55fc7bde6156c83d2c5a7a Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Mon, 12 Jun 2023 16:25:51 +0800 Subject: [PATCH] added GetBitOffset --- inc/hgl/TypeFunc.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/inc/hgl/TypeFunc.h b/inc/hgl/TypeFunc.h index 7ba258f..58aee02 100644 --- a/inc/hgl/TypeFunc.h +++ b/inc/hgl/TypeFunc.h @@ -143,6 +143,24 @@ namespace hgl return count; } + template + inline constexpr int GetBitOffset(const T value) + { + int offset=0; + T bit=1; + + for(int i=0;i