From f6689fe2bde4f1fb8b5b6f960440cbe817f86d56 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 25 Oct 2003 15:17:39 +0000 Subject: [PATCH] write doubles to bams for double types --- panda/src/linmath/lvecBase2_src.I | 10 ++++++++++ panda/src/linmath/lvecBase3_src.I | 12 ++++++++++++ panda/src/linmath/lvecBase4_src.I | 14 ++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/panda/src/linmath/lvecBase2_src.I b/panda/src/linmath/lvecBase2_src.I index e17389675c..0399501a5e 100644 --- a/panda/src/linmath/lvecBase2_src.I +++ b/panda/src/linmath/lvecBase2_src.I @@ -577,8 +577,13 @@ generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LVecBase2):: write_datagram(Datagram &destination) const { +#if FLOATTOKEN == 'f' destination.add_float32(_v.v._0); destination.add_float32(_v.v._1); +#else + destination.add_float64(_v.v._0); + destination.add_float64(_v.v._1); +#endif } //////////////////////////////////////////////////////////////////// @@ -588,7 +593,12 @@ write_datagram(Datagram &destination) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LVecBase2):: read_datagram(DatagramIterator &source) { +#if FLOATTOKEN == 'f' _v.v._0 = source.get_float32(); _v.v._1 = source.get_float32(); +#else + _v.v._0 = source.get_float64(); + _v.v._1 = source.get_float64(); +#endif } diff --git a/panda/src/linmath/lvecBase3_src.I b/panda/src/linmath/lvecBase3_src.I index c245d0d767..aa90976af4 100644 --- a/panda/src/linmath/lvecBase3_src.I +++ b/panda/src/linmath/lvecBase3_src.I @@ -659,9 +659,15 @@ generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LVecBase3):: write_datagram(Datagram &destination) const { +#if FLOATTOKEN == 'f' destination.add_float32(_v.v._0); destination.add_float32(_v.v._1); destination.add_float32(_v.v._2); +#else + destination.add_float64(_v.v._0); + destination.add_float64(_v.v._1); + destination.add_float64(_v.v._2); +#endif } //////////////////////////////////////////////////////////////////// @@ -671,7 +677,13 @@ write_datagram(Datagram &destination) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LVecBase3):: read_datagram(DatagramIterator &source) { +#if FLOATTOKEN == 'f' _v.v._0 = source.get_float32(); _v.v._1 = source.get_float32(); _v.v._2 = source.get_float32(); +#else + _v.v._0 = source.get_float64(); + _v.v._1 = source.get_float64(); + _v.v._2 = source.get_float64(); +#endif } diff --git a/panda/src/linmath/lvecBase4_src.I b/panda/src/linmath/lvecBase4_src.I index d399c13ddb..81c8715db8 100644 --- a/panda/src/linmath/lvecBase4_src.I +++ b/panda/src/linmath/lvecBase4_src.I @@ -699,10 +699,17 @@ generate_hash(ChecksumHashGenerator &hashgen, FLOATTYPE threshold) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LVecBase4):: write_datagram(Datagram &destination) const { +#if FLOATTOKEN == 'f' destination.add_float32(_v.v._0); destination.add_float32(_v.v._1); destination.add_float32(_v.v._2); destination.add_float32(_v.v._3); +#else + destination.add_float64(_v.v._0); + destination.add_float64(_v.v._1); + destination.add_float64(_v.v._2); + destination.add_float64(_v.v._3); +#endif } //////////////////////////////////////////////////////////////////// @@ -712,8 +719,15 @@ write_datagram(Datagram &destination) const { //////////////////////////////////////////////////////////////////// INLINE_LINMATH void FLOATNAME(LVecBase4):: read_datagram(DatagramIterator &source) { +#if FLOATTOKEN == 'f' _v.v._0 = source.get_float32(); _v.v._1 = source.get_float32(); _v.v._2 = source.get_float32(); _v.v._3 = source.get_float32(); +#else + _v.v._0 = source.get_float64(); + _v.v._1 = source.get_float64(); + _v.v._2 = source.get_float64(); + _v.v._3 = source.get_float64(); +#endif }