Minor updates to last commit

This commit is contained in:
kevstone 2023-11-12 13:42:57 +00:00
parent 517b7f02ef
commit 9c6ffa0897
4 changed files with 18 additions and 16 deletions

View File

@ -6,15 +6,15 @@ from funcsig_mapping import FuncSigMapping
grib_bits_funcsig_conversions = [
FuncSigMapping( FuncSig("void", "grib_set_bit_on", [Arg("unsigned char*", "p"), Arg("long*", "bitp")]),
FuncSig("void", "gribSetBitOn", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp")])),
FuncSig("void", "gribSetBitOn", [Arg("DataPointer", "p"), Arg("long&", "bitp")])),
FuncSigMapping( FuncSig("void", "grib_set_bits_on", [Arg("unsigned char*", "p"), Arg("long*", "bitp"), Arg("long", "nbits")]),
FuncSig("void", "gribSetBitsOn", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp"), Arg("long", "nbits")])),
FuncSig("void", "gribSetBitsOn", [Arg("DataPointer", "p"), Arg("long&", "bitp"), Arg("long", "nbits")])),
FuncSigMapping( FuncSig("void", "grib_set_bit_off", [Arg("unsigned char*", "p"), Arg("long*", "bitp")]),
FuncSig("void", "gribSetBitOff", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp")])),
FuncSig("void", "gribSetBitOff", [Arg("DataPointer", "p"), Arg("long&", "bitp")])),
FuncSigMapping( FuncSig("void", "grib_set_bit", [Arg("unsigned char*", "p"), Arg("long", "bitp"), Arg("int", "val")]),
FuncSig("void", "gribSetBit", [Arg("std::vector<unsigned char>&", "p"), Arg("long&", "bitp"), Arg("int", "val")])),
FuncSig("void", "gribSetBit", [Arg("DataPointer", "p"), Arg("long&", "bitp"), Arg("int", "val")])),
]

View File

@ -5,14 +5,14 @@
namespace eccodes::accessor {
void gribSetBitOn(std::vector<unsigned char>& p, long& bitp)
void gribSetBitOn(DataPointer p, long& bitp)
{
long index = bitp / 8;
p[index] |= (1u << (7 - ((bitp) % 8)));
p += bitp / 8;
*p |= (1u << (7 - (bitp % 8)));
bitp++;
}
void gribSetBitsOn(std::vector<unsigned char>& p, long& bitp, long nbits)
void gribSetBitsOn(DataPointer p, long& bitp, long nbits)
{
int i;
for (i = 0; i < nbits; i++) {
@ -20,14 +20,14 @@ void gribSetBitsOn(std::vector<unsigned char>& p, long& bitp, long nbits)
}
}
void gribSetBitOff(std::vector<unsigned char>& p, long& bitp)
void gribSetBitOff(DataPointer p, long& bitp)
{
long index = bitp / 8;
p[index] &= ~(1u << (7 - ((bitp) % 8)));
p += bitp / 8;
*p &= ~(1u << (7 - (bitp % 8)));
bitp++;
}
void gribSetBit(std::vector<unsigned char>& p, long bitp, int val)
void gribSetBit(DataPointer p, long bitp, int val)
{
if (val == 0)
gribSetBitOff(p, bitp);

View File

@ -2,14 +2,15 @@
// C++ implementation of the functions in grib_accessor_class.cc that are not directly part of the C++ classes
#include "AccessorBuffer.h"
#include <vector>
namespace eccodes::accessor {
void gribSetBitOn(std::vector<unsigned char>& p, long& bitp);
void gribSetBitsOn(std::vector<unsigned char>& p, long& bitp, long nbits);
void gribSetBitOff(std::vector<unsigned char>& p, long& bitp);
void gribSetBit(std::vector<unsigned char>& p, long bitp, int val);
void gribSetBitOn(DataPointer p, long& bitp);
void gribSetBitsOn(DataPointer p, long& bitp, long nbits);
void gribSetBitOff(DataPointer p, long& bitp);
void gribSetBit(DataPointer p, long bitp, int val);
}

View File

@ -2,6 +2,7 @@
// All includes in one place, for convenience!
#include "GribAccessorStub.h"
#include "GribAccessorClassStub.h"
#include "GribActionStub.h"
#include "GribAccessorStub.h"
#include "GribBitsAnyEndianStub.h"