summaryrefslogtreecommitdiffstats
path: root/thirdparty/pvrtccompressor/BitUtility.h
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-10-11 20:44:26 +0200
committerRémi Verschelde <rverschelde@gmail.com>2016-10-15 11:50:39 +0200
commitb1e8889d969f5f88539c47c2afac6c9ea2a2dc11 (patch)
treee5d3cec5db3c03d59f257ee94ecbefa48956a602 /thirdparty/pvrtccompressor/BitUtility.h
parentc31ad71f10f68705a456b4257c084d4008c34370 (diff)
downloadredot-engine-b1e8889d969f5f88539c47c2afac6c9ea2a2dc11.tar.gz
dds/etc1/pbm/pvr: Make those modules and split thirdparty files
They are not particularly packaged in Linux distros so we do not facilitate unbundling via SCons. There could be done if/when there is interest. Also s/pnm/pbm/, long-lived typo :)
Diffstat (limited to 'thirdparty/pvrtccompressor/BitUtility.h')
-rw-r--r--thirdparty/pvrtccompressor/BitUtility.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/thirdparty/pvrtccompressor/BitUtility.h b/thirdparty/pvrtccompressor/BitUtility.h
new file mode 100644
index 0000000000..588ff3e892
--- /dev/null
+++ b/thirdparty/pvrtccompressor/BitUtility.h
@@ -0,0 +1,19 @@
+#pragma once
+
+namespace Javelin {
+
+class BitUtility {
+public:
+ static bool IsPowerOf2(unsigned int x) {
+ return (x & (x - 1)) == 0;
+ }
+
+ static unsigned int RotateRight(unsigned int value, unsigned int shift) {
+ if ((shift &= sizeof(value) * 8 - 1) == 0) {
+ return value;
+ }
+ return (value >> shift) | (value << (sizeof(value) * 8 - shift));
+ }
+};
+
+}