summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/object/xdrinput.h2
-rw-r--r--src/os/object/xdrinput.cc12
2 files changed, 14 insertions, 0 deletions
diff --git a/include/object/xdrinput.h b/include/object/xdrinput.h
index f869a13..7b8ac40 100644
--- a/include/object/xdrinput.h
+++ b/include/object/xdrinput.h
@@ -15,6 +15,8 @@ class XDRInput {
int32_t get_int32();
uint64_t get_uint64();
int64_t get_int64();
+ float get_float();
+ double get_double();
uint32_t get_opaque_length();
char* get_opaque(uint32_t length);
};
diff --git a/src/os/object/xdrinput.cc b/src/os/object/xdrinput.cc
index 561c779..077f695 100644
--- a/src/os/object/xdrinput.cc
+++ b/src/os/object/xdrinput.cc
@@ -35,6 +35,18 @@ int64_t XDRInput::get_int64()
return (ret0 << 32) | ret1;
}
+float XDRInput::get_float()
+{
+ uint32_t val = get_uint32();
+ return *(float*)&val;
+}
+
+double XDRInput::get_double()
+{
+ uint64_t val = get_uint64();
+ return *(double*)&val;
+}
+
uint32_t XDRInput::get_opaque_length()
{
return get_uint32();