Mercurial > forge
changeset 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 | 53c5d7e812d4 |
children | d38859613a53 |
files | main/database/DESCRIPTION main/database/doc/dev-postgresql/timeformats.txt main/database/src/converters.cc |
diffstat | 3 files changed, 23 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/main/database/DESCRIPTION Sat Apr 27 07:22:14 2013 +0000 +++ b/main/database/DESCRIPTION Sat Apr 27 08:19:00 2013 +0000 @@ -1,6 +1,6 @@ Name: database Version: 2.1.1 -Date: 2013-04-24 +Date: 2013-04-27 Author: Olaf Till <i7tiol@t-online.de> Maintainer: Olaf Till <i7tiol@t-online.de> Title: Database.
--- a/main/database/doc/dev-postgresql/timeformats.txt Sat Apr 27 07:22:14 2013 +0000 +++ b/main/database/doc/dev-postgresql/timeformats.txt Sat Apr 27 08:19:00 2013 +0000 @@ -1,30 +1,31 @@ timestamp: -Timestamp (8 byte, float or int) +Timestamp (8 byte, float or int) (microseconds (int) or seconds +(float) before or after 'midnight' 2000-01-01; does not fit range?) timestamptz: -TimestampTz (8 byte, float or int) +TimestampTz (8 byte, float or int) (as timestamp) interval: -TimeOffset (8 byte, float or int) (all except day, month, year) +TimeOffset (8 byte, float or int) (microseconds (int) or seconds (float)) int32 (days) -int32 (months and years) +int32 (months) time: -TimeADT (8 byte, float or int) +TimeADT (8 byte, float or int) (microseconds (int) or seconds (float) ?) -timetz: +timetz (don't implement?): -TimeADT (8 byte, float or int) (all except month, year) +TimeADT (8 byte, float or int) (microseconds (int) or seconds (float) ?) int32 (timezone in seconds)
--- 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))