summaryrefslogtreecommitdiff
path: root/gpt.cc
diff options
context:
space:
mode:
authorRoderick W. Smith <rodsmith@rodsbooks.com>2014-03-28 23:54:21 -0400
committerRoderick W. Smith <rodsmith@rodsbooks.com>2014-03-28 23:54:21 -0400
commit1f7822eb54337766002431f01e5934c7d4703628 (patch)
tree7008707bbc852136bfc5c879cfde1078ebd52f5d /gpt.cc
parent1a65132980bfef8f9c898afbefcda00277b5ee48 (diff)
downloadsgdisk-1f7822eb54337766002431f01e5934c7d4703628.tar.gz
Changes to support compilation with UEFI GPT fdisk library.
Diffstat (limited to 'gpt.cc')
-rw-r--r--gpt.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/gpt.cc b/gpt.cc
index fdffb25..18247c5 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -38,6 +38,23 @@ using namespace std;
#define log2(x) (log((double) x) / log(2.0))
#endif // Microsoft Visual C++
+#ifdef EFI
+// in UEFI mode MMX registers are not yet available so using the
+// x86_64 ABI to move "double" values around is not an option.
+#ifdef log2
+#undef log2
+#endif
+#define log2(x) log2_32( x )
+static inline uint32_t log2_32(uint32_t v) {
+ int r = -1;
+ while (v >= 1) {
+ r++;
+ v >>= 1;
+ }
+ return r;
+}
+#endif
+
/****************************************
* *
* GPTData class and related structures *