[PATCH] Add getSwappedBytes implementations for float / double
Matt Arsenault
Matthew.Arsenault at amd.com
Tue Jan 13 12:08:33 PST 2015
Alternative version which specializes endian::Writer
http://reviews.llvm.org/D6730
Files:
include/llvm/Support/EndianStream.h
Index: include/llvm/Support/EndianStream.h
===================================================================
--- include/llvm/Support/EndianStream.h
+++ include/llvm/Support/EndianStream.h
@@ -31,6 +31,31 @@
OS.write((const char *)&Val, sizeof(value_type));
}
};
+
+template <>
+template <>
+inline void Writer<little>::write<float>(float Val) {
+ write(FloatToBits(Val));
+}
+
+template <>
+template <>
+inline void Writer<little>::write<double>(double Val) {
+ write(DoubleToBits(Val));
+}
+
+template <>
+template <>
+inline void Writer<big>::write<float>(float Val) {
+ write(FloatToBits(Val));
+}
+
+template <>
+template <>
+inline void Writer<big>::write<double>(double Val) {
+ write(DoubleToBits(Val));
+}
+
} // end namespace endian
} // end namespace support
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6730.18104.patch
Type: text/x-patch
Size: 789 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150113/47ac66a6/attachment.bin>
More information about the llvm-commits
mailing list