From 6fa1b1c6007d4dcd8eb10f8323414d10a6e2bf9a Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 6 Mar 2015 15:31:27 -0800 Subject: [PATCH] remove unused cruft and fix float casts --- libraries/shared/src/OctalCode.cpp | 15 ++++----------- libraries/shared/src/OctalCode.h | 3 --- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/libraries/shared/src/OctalCode.cpp b/libraries/shared/src/OctalCode.cpp index 82bd471975..f26f103487 100644 --- a/libraries/shared/src/OctalCode.cpp +++ b/libraries/shared/src/OctalCode.cpp @@ -129,18 +129,17 @@ unsigned char* childOctalCode(const unsigned char* parentOctalCode, char childNu void voxelDetailsForCode(const unsigned char* octalCode, VoxelPositionSize& voxelPositionSize) { float output[3]; memset(&output[0], 0, 3 * sizeof(float)); - float currentScale = 1.0; + float currentScale = 1.0f; if (octalCode) { for (int i = 0; i < numberOfThreeBitSectionsInCode(octalCode); i++) { - currentScale *= 0.5; + currentScale *= 0.5f; int sectionIndex = sectionValue(octalCode + 1 + (BITS_IN_OCTAL * i / BITS_IN_BYTE), (BITS_IN_OCTAL * i) % BITS_IN_BYTE); for (int j = 0; j < BITS_IN_OCTAL; j++) { - output[j] += currentScale * (int)oneAtBit(sectionIndex, (BITS_IN_BYTE - BITS_IN_OCTAL) + j); + output[j] += currentScale * (float)oneAtBit(sectionIndex, (BITS_IN_BYTE - BITS_IN_OCTAL) + j); } - } } voxelPositionSize.x = output[0]; @@ -152,7 +151,7 @@ void voxelDetailsForCode(const unsigned char* octalCode, VoxelPositionSize& voxe void copyFirstVertexForCode(const unsigned char* octalCode, float* output) { memset(output, 0, 3 * sizeof(float)); - float currentScale = 0.5; + float currentScale = 0.5f; for (int i = 0; i < numberOfThreeBitSectionsInCode(octalCode); i++) { int sectionIndex = sectionValue(octalCode + 1 + (3 * i / 8), (3 * i) % 8); @@ -165,12 +164,6 @@ void copyFirstVertexForCode(const unsigned char* octalCode, float* output) { } } -float * firstVertexForCode(const unsigned char* octalCode) { - float * firstVertex = new float[3]; - copyFirstVertexForCode(octalCode, firstVertex); - return firstVertex; -} - OctalCodeComparison compareOctalCodes(const unsigned char* codeA, const unsigned char* codeB) { if (!codeA || !codeB) { return ILLEGAL_CODE; diff --git a/libraries/shared/src/OctalCode.h b/libraries/shared/src/OctalCode.h index 07895ff67f..9229157c3d 100644 --- a/libraries/shared/src/OctalCode.h +++ b/libraries/shared/src/OctalCode.h @@ -43,9 +43,6 @@ const int CHECK_NODE_ONLY = -1; bool isAncestorOf(const unsigned char* possibleAncestor, const unsigned char* possibleDescendent, int descendentsChild = CHECK_NODE_ONLY); -// Note: copyFirstVertexForCode() is preferred because it doesn't allocate memory for the return -// but other than that these do the same thing. -float * firstVertexForCode(const unsigned char* octalCode); void copyFirstVertexForCode(const unsigned char* octalCode, float* output); struct VoxelPositionSize {