mirror of https://github.com/ecmwf/eccodes.git
Performance: Local static function
This commit is contained in:
parent
2aa60b84e2
commit
47258f4920
|
@ -23,6 +23,14 @@ void grib_accessor_class_g2bitmap_t::init(grib_accessor* a, const long len, grib
|
|||
self->numberOfValues = grib_arguments_get_name(grib_handle_of_accessor(a), arg, 4);
|
||||
}
|
||||
|
||||
// For speed use a local static function
|
||||
static void set_bit_on(unsigned char* p, long* bitp)
|
||||
{
|
||||
p += *bitp / 8;
|
||||
*p |= (1u << (7 - ((*bitp) % 8)));
|
||||
(*bitp)++;
|
||||
}
|
||||
|
||||
int grib_accessor_class_g2bitmap_t::pack_double(grib_accessor* a, const double* val, size_t* len)
|
||||
{
|
||||
grib_accessor_g2bitmap_t* self = (grib_accessor_g2bitmap_t*)a;
|
||||
|
@ -47,7 +55,7 @@ int grib_accessor_class_g2bitmap_t::pack_double(grib_accessor* a, const double*
|
|||
pos++;
|
||||
else {
|
||||
// bmaplen++;
|
||||
grib_set_bit_on(buf, &pos);
|
||||
set_bit_on(buf, &pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue