gd_endianness(3)
β¨ gd_endianness β¨
okay so bestie, welcome to gd_endianness(3) β a lil GetData manual page that answers the eternal question: which way do your bytes face π
this one lives in section 3 of the manual, and it's giving "short but iconic." no cap.
πΈ NAME πΈ
gd_endianness β report the byte sex of fields in a Dirfile π«Ά
π¦ SYNOPSIS π¦
#include <getdata.h>
unsigned long gd_endianness(DIRFILE *dirfile, int fragment_index);
π DESCRIPTION π
so gd_endianness() goes and queries a dirfile(5) database β that's the one you pass in as dirfile β and it fetches the byte sex of the fragment at index fragment_index. yes we're really calling it that, that's the actual terminology, i don't make the rules π
and what does byte sex even mean here? it's the endianness of the data files tied to the RAW fields defined in that specified fragment. that's the whole vibe.
tiny lil caveat bestie: if a fragment has no RAW fields in it, its endianness is literally not meaningful. there's nothing to be endian about. so don't come for it π
also, the dirfile argument has to point to a valid DIRFILE object β and it has to be one that was already created by a call to gd_open(3). no hand-rolled ones, no guessing, we need the real thing β¨
π RETURN VALUE π
when it works? slay. gd_endianness() hands you back the byte sex of that fragment, which is either GD_BIG_ENDIAN or GD_LITTLE_ENDIAN.
and then β plot twist β that value gets bitwise-or'd with either GD_ARM_ENDIAN or GD_NOT_ARM_ENDIAN. and why, you ask? because it tells you whether the double-precision floating point data in this fragment is stored in the old ARM middle-endian format. yes, middle-endian. a whole third option. history is wild fr fr π§
but when it goes wrong π this function returns zero and stashes a negative-valued error code inside the DIRFILE object. you can grab that later with a subsequent call to gd_error(3). the possible error codes are:
GD_E_BAD_DIRFILEβ the supplied dirfile was invalid. not it. πGD_E_BAD_INDEXβ the supplied index was out of range. bestie that fragment does not exist π
and if you want the actual words, not just the number, you can get a descriptive error string by calling gd_error_string(3) π
β HISTORY β
so the get_endianness() function first appeared in GetData-0.5.0. iconic debut, no notes.
then in GetData-0.7.0 it got a glow-up and was renamed to gd_endianness(). and that same version also added the GD_ARM_ENDIAN and GD_NOT_ARM_ENDIAN flags. character development π
π₯ SEE ALSO π₯
gd_alter_endianness(3)gd_getdata(3)gd_error(3)gd_error_string(3)gd_open(3)dirfile(5)dirfile-format(5)
that's the whole page bestie, go read your bytes π
this was Version 0.10.0, dated 25 December 2016 β a lil Christmas gift from the GETDATA girlies πβ¨ mwah, bye!!
π¦ where this page comes from
- debian bookworm: libgetdata-doc 0.11.0-6
- debian trixie: libgetdata-doc 0.11.0-15
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- nixos 26.05: getdata 0.11.0
- nixpkgs unstable: getdata 0.11.0
- ubuntu jammy: libgetdata-doc 0.11.0-3ubuntu1
- ubuntu noble: libgetdata-doc 0.11.0-13
- ubuntu questing: libgetdata-doc 0.11.0-15
- ubuntu resolute: libgetdata-doc 0.11.0-17build1
- ubuntu stonking: libgetdata-doc 0.11.0-17build2
- Copyright (C) 2016 D. V. Wiebe
- Copyright (C) 2008, 2010, 2016 D.V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms