Browse Source

write doubles to bams for double types

David Rose 22 years ago
parent
commit
f6689fe2bd

+ 10 - 0
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
 }
 

+ 12 - 0
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
 }

+ 14 - 0
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
 }