Browse Source

Merge commit '51575ea' into bfgminer

Luke Dashjr 11 years ago
parent
commit
9b4eec479e
1 changed files with 10 additions and 0 deletions
  1. 10 0
      util.h

+ 10 - 0
util.h

@@ -403,6 +403,16 @@ void pk_u64le(void * const bufp, const int offset, const uint64_t nv)
 	buf[offset+7] = (nv >> 0x38) & 0xff;
 }
 
+static inline
+uint32_t upper_power_of_two_u32(uint32_t n)
+{
+	--n;
+	for (int i = 1; i <= 0x10; i *= 2)
+		n |= n >> i;
+	++n;
+	return n;
+}
+
 
 typedef struct bytes_t {
 	uint8_t *buf;