Browse files

Fixes issue with latest Xcode and compiling for release mode

  • Loading branch information...
1 parent 6964190 commit a205146d4664e15f5fcf9d47146b26f016d6a055 Viktor Lidholt committed Jan 28, 2013
Showing with 11 additions and 3 deletions.
  1. +11 −3 CCBReader/CCBReader.m
View
14 CCBReader/CCBReader.m
@@ -192,11 +192,19 @@ - (float) readFloat
case kCCBFloatInteger:
return [self readIntWithSign:YES];
default: {
- // using a memcpy since the compiler isn't
- // doing the float ptr math correctly on device.
+ // Copy the float byte by byte
+ // memcpy dosn't work on latest Xcode (4.6)
float * pF = (float*)(bytes+currentByte);
float f = 0;
- memcpy(&f, pF, sizeof(float));
+
+ unsigned char* src = (unsigned char*) pF;
+ unsigned char* dst = (unsigned char*) &f;
+
+ for (int i = 0; i < 4; i++)
+ {
+ dst[i] = src[i];
+ }
+
currentByte+=4;
return f;
}

0 comments on commit a205146

Please sign in to comment.