gbits.c(3)

πŸ“¦
version 2.3.0 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

gbits.c πŸ’– β€” bestie's guide to packing & unpacking bits ✨

okay so this is a page from the Library Functions Manual (yes, that kind of manual, the gbits.c(3) one) and it's literally all about cramming numbers into bit strings and pulling them back out again. no cap. let's get into it 🫢


🌸 NAME 🌸

gbits.c β€” functions to pack and unpack bits to/from a packed bit string.


✨ SYNOPSIS ✨

#include 'grib2_int.h'

πŸŽ€ Functions πŸŽ€

  • void g2c_gbit_int (unsigned char *in, int *iout, int iskip, int nbits) β€” extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array.
  • int g2c_gbits_int (unsigned char *in, int *iout, int iskip, int nbits, int nskip, int n) β€” extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array.
  • void gbit (unsigned char *in, g2int *iout, g2int iskip, g2int nbits) β€” get arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array.
  • void gbits (unsigned char *in, g2int *iout, g2int iskip, g2int nbits, g2int nskip, g2int n) β€” unpack arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array.
  • void sbit (unsigned char *out, g2int *in, g2int iskip, g2int nbits) β€” store arbitrary size values into a packed bit string, taking the low order bits from each value in the unpacked array.
  • void sbits (unsigned char *out, g2int *in, g2int nbits, g2int nskip, g2int n) β€” store arbitrary size values into a packed bit string, taking the low order bits from each value in the unpacked array.

wait no, let me not do that to you 😭 the last one is:

  • void sbits (unsigned char *out, g2int *in, g2int iskip, g2int nbits, g2int nskip, g2int n) β€” store arbitrary size values into a packed bit string, taking the low order bits from each value in the unpacked array.

ok phew. anyway πŸ’…


πŸ¦‹ Detailed Description πŸ¦‹

functions to pack and unpack bits to/from a packed bit string. that's the whole vibe. it's giving bit-shuffling excellence ✨

Author: NOAA Programmer

Definition in file gbits.c.


πŸ‘‘ Function Documentation πŸ‘‘

🌈 void g2c_gbit_int (unsigned char * in, int * iout, int iskip, int nbits)

extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. this is similar to gbit(), but with int types instead of g2int. so like, the same energy but a glow-up on the types πŸ’…

Parameters

  • in β€” pointer to character array input.
  • iout β€” pointer that gets the unpacked array output.
  • iskip β€” initial number of bits to skip.
  • nbits β€” number of bits to take.

Author: NOAA Programmer

Definition at line 113 of file gbits.c.

References g2c_gbits_int().


πŸ’œ int g2c_gbits_int (unsigned char * in, int * iout, int iskip, int nbits, int nskip, int n)

extract arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. this is similar to gbits(), but with int types instead of g2int. twin but make it int fr fr 🫢

Parameters

  • in β€” Pointer to character array input.
  • iout β€” Pointer that gets the unpacked array output.
  • iskip β€” Initial number of bits to skip.
  • nbits β€” Number of bits to take.
  • nskip β€” Additional number of bits to skip on each iteration.
  • n β€” Number of iterations.

Returns

  • G2C_NOERROR β€” No error.
  • G2C_ENOMEM β€” Out of memory.

Author: Ed Hartnett

Date: 8/31/22

Definition at line 137 of file gbits.c.

References G2C_EINVAL, G2C_ENOMEM, G2C_NOERROR, and gbits().

Referenced by g2c_gbit_int().


⭐ void gbit (unsigned char * in, g2int * iout, g2int iskip, g2int nbits)

get arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. the O.G. version. iconic, honestly πŸ‘‘

Parameters

  • in β€” pointer to character array input.
  • iout β€” pointer that gets the unpacked array output.
  • iskip β€” initial number of bits to skip.
  • nbits β€” number of bits to take.

Author: NOAA Programmer

Definition at line 20 of file gbits.c.

References gbits().

Referenced by comunpack(), g2_addfield(), g2_addgrid(), g2_addlocal(), g2_getfld(), g2_gribend(), g2_info(), g2_unpack1(), g2_unpack2(), g2_unpack3(), g2_unpack4(), g2_unpack5(), g2_unpack6(), g2c_check_msg(), g2c_unpack7_int(), and seekgb().

not it being referenced by SIXTEEN other functions 😭 main character energy fr

🧚 void gbits (unsigned char * in, g2int * iout, g2int iskip, g2int nbits, g2int nskip, g2int n)

unpack arbitrary size values from a packed bit string, right justifying each value in the unpacked iout array. this is the one that does the actual heavy lifting, lowkey the backbone of the whole file πŸ’–

Parameters

  • in β€” Pointer to character array input.
  • iout β€” Pointer that gets the unpacked array output.
  • iskip β€” Initial number of bits to skip.
  • nbits β€” Number of bits to take.
  • nskip β€” Additional number of bits to skip on each iteration.
  • n β€” Number of iterations.

Author: NOAA Programmer

Definition at line 57 of file gbits.c.

Referenced by aecunpack_int(), comunpack(), g2_unpack3(), g2_unpack4(), g2_unpack6(), g2c_gbits_int(), gbit(), pngunpack_int(), simunpack(), and specunpack().


πŸ“ void sbit (unsigned char * out, g2int * in, g2int iskip, g2int nbits)

store arbitrary size values into a packed bit string, taking the low order bits from each value in the unpacked array. this is the packer β€” it's the reverse direction bestie, we're SQUISHING now 🫸✨

Parameters

  • out β€” Pointer to packed array output. Must be allocated large enough to hold output.
  • in β€” Pointer that gets the unpacked array input.
  • iskip β€” Initial number of bits to skip.
  • nbits β€” Number of bits to pack.

Author: NOAA Programmer

Definition at line 38 of file gbits.c.

References sbits().

Referenced by compack(), g2_addfield(), g2_addgrid(), g2_addlocal(), g2_create(), g2_gribend(), misspack(), and simpack().


🌸 void sbits (unsigned char * out, g2int * in, g2int iskip, g2int nbits, g2int nskip, g2int n)

store arbitrary size values into a packed bit string, taking the low order bits from each value in the unpacked array. the full-service packing experience, skips and iterations included πŸ’…

Parameters

  • out β€” Pointer to packed array output. Must be allocated large enough to hold output.
  • in β€” Pointer that gets the unpacked array input.
  • iskip β€” Initial number of bits to skip.
  • nbits β€” Number of bits to pack.
  • nskip β€” Additional number of bits to skip on each iteration.
  • n β€” Number of iterations.

Author: NOAA Programmer

Definition at line 178 of file gbits.c.

Referenced by aecpack_int(), compack(), g2_addfield(), g2_addgrid(), jpcpack_int(), misspack(), pngpack_int(), sbit(), and simpack().


πŸ’« Author πŸ’«

Generated automatically by Doxygen for NCEPLIBS-g2c from the source code.


okay and that's the whole page bestie, no crumbs left πŸŽ€ this one came from NCEPLIBS-g2c, Version 2.3.0, and it's the gbits.c(3) page β€” go pack some bits, you absolute legend πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from