Mercurial > forge
diff main/database/src/converters.cc @ 11655:6bbb1584d933 octave-forge
More efficient code order in float converters (probably useless with -O0).
Some more explanations in timeformat notes.
author | i7tiol |
---|---|
date | Sat, 27 Apr 2013 08:19:00 +0000 |
parents | bd5a8f1bdfb8 |
children | d38859613a53 |
line wrap: on
line diff
--- a/main/database/src/converters.cc Sat Apr 27 07:22:14 2013 +0000 +++ b/main/database/src/converters.cc Sat Apr 27 08:19:00 2013 +0000 @@ -190,14 +190,6 @@ int from_octave_bin_float8 (const octave_value &ov, oct_pq_dynvec_t &val) { - double d = ov.double_value (); - - if (error_state) - { - error ("can not convert octave_value to float8 value"); - return 1; - } - union { double d; @@ -205,7 +197,13 @@ } swap; - swap.d = d; + swap.d = ov.double_value (); + + if (error_state) + { + error ("can not convert octave_value to float8 value"); + return 1; + } OCT_PQ_PUT(val, int64_t, htobe64 (swap.i)) @@ -261,14 +259,6 @@ int from_octave_bin_float4 (const octave_value &ov, oct_pq_dynvec_t &val) { - double f = ov.float_value (); - - if (error_state) - { - error ("can not convert octave_value to float4 value"); - return 1; - } - union { float f; @@ -276,7 +266,13 @@ } swap; - swap.f = f; + swap.f = ov.float_value (); + + if (error_state) + { + error ("can not convert octave_value to float4 value"); + return 1; + } OCT_PQ_PUT(val, int32_t, htobe32 (swap.i))