You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/01/14 20:21:30 UTC
[lucy-commits] [44/50] git commit: Don't use stdint types in
Charmonizer::Probe::Floats
Don't use stdint types in Charmonizer::Probe::Floats
Use a char array to hold the floating point representations of special
values. This is needed for the upcoming changes that add the ability to
create a charmony.h which doesn't define the stdint types.
Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/ff32689a
Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/ff32689a
Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/ff32689a
Branch: refs/heads/master
Commit: ff32689a0d4326651dd77b8fa42505fc3f692c4d
Parents: cc16e42
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 18 17:14:46 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon May 20 21:01:12 2013 +0200
----------------------------------------------------------------------
src/Charmonizer/Probe/Floats.c | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/ff32689a/src/Charmonizer/Probe/Floats.c
----------------------------------------------------------------------
diff --git a/src/Charmonizer/Probe/Floats.c b/src/Charmonizer/Probe/Floats.c
index b78ec00..6c3969d 100644
--- a/src/Charmonizer/Probe/Floats.c
+++ b/src/Charmonizer/Probe/Floats.c
@@ -27,14 +27,35 @@ chaz_Floats_run(void) {
chaz_ConfWriter_start_module("Floats");
chaz_ConfWriter_append_conf(
- "typedef union { uint32_t i; float f; } chy_floatu32;\n"
- "typedef union { uint64_t i; double d; } chy_floatu64;\n"
- "static const chy_floatu32 chy_f32inf = {UINT32_C(0x7f800000)};\n"
- "static const chy_floatu32 chy_f32neginf = {UINT32_C(0xff800000)};\n"
- "static const chy_floatu32 chy_f32nan = {UINT32_C(0x7fc00000)};\n"
- "static const chy_floatu64 chy_f64inf = {UINT64_C(0x7ff0000000000000)};\n"
- "static const chy_floatu64 chy_f64neginf = {UINT64_C(0xfff0000000000000)};\n"
- "static const chy_floatu64 chy_f64nan = {UINT64_C(0x7ff8000000000000)};\n"
+ "typedef union { unsigned char c[4]; float f; } chy_floatu32;\n"
+ "typedef union { unsigned char c[8]; double d; } chy_floatu64;\n"
+ "#ifdef CHY_BIG_END\n"
+ "static const chy_floatu32 chy_f32inf\n"
+ " = { { 0x7F, 0x80, 0, 0 } };\n"
+ "static const chy_floatu32 chy_f32neginf\n"
+ " = { { 0xFF, 0x80, 0, 0 } };\n"
+ "static const chy_floatu32 chy_f32nan\n"
+ " = { { 0x7F, 0xC0, 0, 0 } };\n"
+ "static const chy_floatu64 chy_f64inf\n"
+ " = { { 0x7F, 0xF0, 0, 0, 0, 0, 0, 0 } };\n"
+ "static const chy_floatu64 chy_f64neginf\n"
+ " = { { 0xFF, 0xF0, 0, 0, 0, 0, 0, 0 } };\n"
+ "static const chy_floatu64 chy_f64nan\n"
+ " = { { 0x7F, 0xF8, 0, 0, 0, 0, 0, 0 } };\n"
+ "#else /* BIG_END */\n"
+ "static const chy_floatu32 chy_f32inf\n"
+ " = { { 0, 0, 0x80, 0x7F } };\n"
+ "static const chy_floatu32 chy_f32neginf\n"
+ " = { { 0, 0, 0x80, 0xFF } };\n"
+ "static const chy_floatu32 chy_f32nan\n"
+ " = { { 0, 0, 0xC0, 0x7F } };\n"
+ "static const chy_floatu64 chy_f64inf\n"
+ " = { { 0, 0, 0, 0, 0, 0, 0xF0, 0x7F } };\n"
+ "static const chy_floatu64 chy_f64neginf\n"
+ " = { { 0, 0, 0, 0, 0, 0, 0xF0, 0xFF } };\n"
+ "static const chy_floatu64 chy_f64nan\n"
+ " = { { 0, 0, 0, 0, 0, 0, 0xF8, 0x7F } };\n"
+ "#endif /* BIG_END */\n"
);
chaz_ConfWriter_add_def("F32_INF", "(chy_f32inf.f)");
chaz_ConfWriter_add_def("F32_NEGINF", "(chy_f32neginf.f)");