Skip to content

Commit

Permalink
fix COMP-3 size calculation
Browse files Browse the repository at this point in the history
brought up by Sauro Menna

additional using that opportunity to drop the floating point calculation
  • Loading branch information
GitMensch committed Nov 6, 2023
1 parent 69e2671 commit 43a16b2
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions runtime/libgixsql/SqlVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/

#include <stdlib.h>
#include <math.h>
#include <string>
#include <cstring>
#include <locale.h>
#include <inttypes.h>
Expand Down Expand Up @@ -169,11 +167,8 @@ void SqlVar::createRealData()
}
case CobolVarType::COBOL_TYPE_UNSIGNED_NUMBER_PD:
{
double dlength;
int skip_first;

dlength = ceil(((double)length + 1) / 2);
skip_first = (length + 1) % 2; // 1 -> skip first 4 bits
const int dlength = (length / 2) + 1;
const int skip_first = (length + 1) % 2; // 1 -> skip first 4 bits

int index = 0;
const unsigned char ubit = 0xF0;
Expand All @@ -200,11 +195,8 @@ void SqlVar::createRealData()
}
case CobolVarType::COBOL_TYPE_SIGNED_NUMBER_PD:
{
double dlength;
int skip_first;

dlength = ceil(((double)length + 1) / 2);
skip_first = (length + 1) % 2; // 1 -> skip first 4 bits
const int dlength = (length / 2) + 1;
const int skip_first = (length + 1) % 2; // 1 -> skip first 4 bits

/* set real data */
int index = SIGN_LENGTH;
Expand Down

0 comments on commit 43a16b2

Please sign in to comment.