[Scummvm-cvs-logs] scummvm master -> 4c64f7e194e5ce74a9213ef09648e615f3661de6

RichieSams adastley at gmail.com
Wed Jan 7 14:01:07 CET 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4c64f7e194 SWORD25: Remove unused code


Commit: 4c64f7e194e5ce74a9213ef09648e615f3661de6
    https://github.com/scummvm/scummvm/commit/4c64f7e194e5ce74a9213ef09648e615f3661de6
Author: RichieSams (adastley at gmail.com)
Date: 2015-01-07T07:00:13-06:00

Commit Message:
SWORD25: Remove unused code

The original idea was to keep the code variation and pick the best one. However,
these two methods we're portable enough for our needs.

Changed paths:
    engines/sword25/util/double_serialization.cpp
    engines/sword25/util/double_serialization.h



diff --git a/engines/sword25/util/double_serialization.cpp b/engines/sword25/util/double_serialization.cpp
index a34eb0f..73da296 100644
--- a/engines/sword25/util/double_serialization.cpp
+++ b/engines/sword25/util/double_serialization.cpp
@@ -65,80 +65,4 @@ double decodeDouble(SerializedDouble value) {
 	return ((value.signAndSignificandTwo & 0x80000000) == 0x80000000) ? -returnValue : returnValue;
 }
 
-#if 0
-
-// Why these are needed?
-
-uint64 encodeDouble_64(double value) {
-	// Split the value into its significand and exponent
-	int exponent;
-	double significand = frexp(value, &exponent);
-
-	// Shift the significand into the integer range
-	double shiftedsignificand = ldexp(abs(significand), 53);
-
-	// Combine everything using the IEEE standard
-	uint64 uintsignificand = (uint64)shiftedsignificand;
-	return ((uint64)(value < 0 ? 1 : 0) << 63) |        // Sign
-	       ((uint64)(exponent + 1023) << 52) |          // Exponent stored as an offset to 1023
-	       (uintsignificand & 0x000FFFFFFFFFFFFFLL);      // significand with MSB inferred
-}
-
-double decodeDouble_64(uint64 value) {
-	// Expand the exponent and significand
-	int exponent = (int)((value >> 52) & 0x7FF) - 1023;
-	double expandedsignificand = (double)(0x10000000000000LL /* Inferred MSB */ | (value & 0x000FFFFFFFFFFFFFLL));
-
-	// Deflate the significand
-	int temp;
-	double significand = frexp(expandedsignificand, &temp);
-
-	// Re-calculate the actual double
-	double returnValue = ldexp(significand, exponent);
-
-	// Check the sign bit and return
-	return ((value & 0x8000000000000000LL) == 0x8000000000000000LL) ? -returnValue : returnValue;
-}
-
-CompactSerializedDouble encodeDouble_Compact(double value) {
-	// Split the value into its significand and exponent
-	int exponent;
-	double significand = frexp(value, &exponent);
-
-	// Shift the the first part of the significand into the integer range
-	double shiftedsignificandPart = ldexp(abs(significand), 32);
-	uint32 significandOne = uint32(floor(shiftedsignificandPart));
-
-	// Shift the remainder of the significand into the integer range
-	shiftedsignificandPart -= significandOne;
-	uint32 significandTwo = (uint32)(ldexp(shiftedsignificandPart, 21));
-
-	CompactSerializedDouble returnValue;
-	returnValue.signAndSignificandOne = ((uint32)(value < 0 ? 1 : 0) << 31) |   // Sign
-	                                    (significandOne & 0x7FFFFFFF);          // significandOne with MSB inferred
-	// Exponent stored as an offset to 1023
-	returnValue.exponentAndSignificandTwo = ((uint32)(exponent + 1023) << 21) | significandTwo;
-
-	return returnValue;
-}
-
-double decodeDouble_Compact(CompactSerializedDouble value) {
-	// Expand the exponent and the parts of the significand
-	int exponent = (int)(value.exponentAndSignificandTwo >> 21) - 1023;
-	double expandedsignificandOne = (double)(0x80000000 /* Inferred MSB */ | (value.signAndSignificandOne & 0x7FFFFFFF));
-	double expandedsignificandTwo = (double)(value.exponentAndSignificandTwo & 0x1FFFFF);
-
-	// Deflate the significand
-	double shiftedsignificand = ldexp(expandedsignificandTwo, -21);
-	double significand = ldexp(expandedsignificandOne + shiftedsignificand, -32);
-
-	// Re-calculate the actual double
-	double returnValue = ldexp(significand, exponent);
-
-	// Check the sign bit and return
-	return ((value.signAndSignificandOne & 0x80000000) == 0x80000000) ? -returnValue : returnValue;
-}
-
-#endif
-
 } // End of namespace Sword25
diff --git a/engines/sword25/util/double_serialization.h b/engines/sword25/util/double_serialization.h
index a910a66..af58d03 100644
--- a/engines/sword25/util/double_serialization.h
+++ b/engines/sword25/util/double_serialization.h
@@ -56,43 +56,6 @@ SerializedDouble encodeDouble(double value);
  */
 double decodeDouble(SerializedDouble value);
 
-#if 0
-/**
- * Encodes a double as a uint64
- *
- * Does NOT support denormalized numbers. Does NOT support NaN, or Inf
- *
- * @param value    The value to encode
- * @return         The encoded value
- */
-uint64 encodeDouble_64(double value);
-/**
- * Decodes a previously encoded double
- *
- * @param value    The value to decode
- * @return         The decoded value
- */
-double decodeDouble_64(uint64 value);
-
-/**
- * Encodes a double as two uint32
- *
- * Does NOT support denormalized numbers. Does NOT support NaN, or Inf
- *
- * @param value    The value to encode
- * @return         The encoded value
- */
-CompactSerializedDouble encodeDouble_Compact(double value);
-/**
- * Decodes a previously encoded double
- *
- * @param value    The value to decode
- * @return         The decoded value
- */
-double decodeDouble_Compact(CompactSerializedDouble value);
-
-#endif
-
 } // End of namespace Sword25
 
 #endif






More information about the Scummvm-git-logs mailing list