Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential fix for Arm Linux testing. #583

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Linux_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: true
matrix:
jasper-version: [2.0.33, 3.0.3, 4.0.0]
ccompiler: [clang, gcc-12]
ccompiler: [clang, gcc-12, gcc-13, gcc-14]
include:
- jasper-version: 4.0.0
ccompiler: gcc-14
Expand Down
16 changes: 9 additions & 7 deletions src/g2cio.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ g2c_file_io(FILE *f, int write, int g2ctype, void *var)
if (write)
{
/* Are we writing a negative number? */
if (g2ctype == G2C_BYTE && *bvar < 0)
{
byte_tmp = -1 * *bvar; /* Store as positive. */
byte_tmp |= 1UL << BITSHIFT_7; /* Set sign bit. */
}
else
byte_tmp = *bvar;
//if (g2ctype == G2C_BYTE && *bvar < 0)
//{
// byte_tmp = -1 * *bvar; /* Store as positive. */
// byte_tmp |= 1UL << BITSHIFT_7; /* Set sign bit. */
//}
//else
byte_tmp = *bvar;

/* Convert result to big-endian. */
byte_be = byte_tmp;
Expand Down Expand Up @@ -159,12 +159,14 @@ g2c_file_io(FILE *f, int write, int g2ctype, void *var)
/* No conversion needed for one-byte values. */
*bvar = byte_be;

#ifndef IS_ARM_LINUX
/* Did we read a negative number? Check the sign bit... */
if (g2ctype == G2C_BYTE && *bvar & 1 << BITSHIFT_7)
{
*bvar &= ~(1UL << BITSHIFT_7); /* Clear sign bit. */
*bvar *= -1; /* Make it negative. */
}
#endif
break;
case G2C_SHORT:
case G2C_USHORT:
Expand Down
3 changes: 3 additions & 0 deletions src/grib2_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

#include "grib2.h"

/** Define is system is Arm Linux. */
#define IS_ARM_LINUX __aarch64__ &&__linux__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want this define.

Is there a way to detect whatever is happening on ARM and handle it without having platform specific defines?


#define ALOG2 (0.69314718) /**< ln(2.0) */

/** Name of JPEG codec in Jasper. */
Expand Down
Loading