TIFFSWAB(3tiff)
π TIFFSWAB β byte- and bit-swapping routines
okay bestie, welcome to TIFFswab(3tiff) from LibTIFF β the little family of functions that flips your bytes around so your endianness situation stops being a whole mess. it's giving endianness rescue mission and honestly? obsessed. π¦
β¨ SYNOPSIS β¨
#include <tiffio.h>
const unsigned char *TIFFGetBitRevTable(int reversed)
void TIFFReverseBits(u_char *data, unsigned long nbytes)
void TIFFSwabShort(uint16_t *data)
void TIFFSwabLong(uint32_t *data)
void TIFFSwabLong8(uint64_t *lp)
void TIFFSwabFloat(float *fp)
void TIFFSwabDouble(double *dp)
void TIFFSwabArrayOfShort(uint16_t *wp, tmsize_t n)
void TIFFSwabArrayOfTriples(uint8_t *tp, tmsize_t n)
void TIFFSwabArrayOfLong(uint32_t *lp, tmsize_t n)
void TIFFSwabArrayOfLong8(uint64_t *lp, tmsize_t n)
void TIFFSwabArrayOfFloat(float *fp, tmsize_t n)
void TIFFSwabArrayOfDouble(double *dp, tmsize_t n)
πΈ DESCRIPTION πΈ
so here's the tea β: these routines are the ones the library itself uses to swap 16-, 32- and 64-bit data around, plus reverse the order of bits inside bytes. lowkey iconic of them.
TIFFSwabShort()andTIFFSwabLong()andTIFFSwabFloat()β swap the bytes in a single 16- and 32-bit item, respectively.TIFFSwabLong8()andTIFFSwabDouble()β swap the bytes in a single 64-bit item.TIFFSwabArrayOfTriples()β swaps the first and the third byte of each triple (three bytes) inside the byte array. the second byte of each triple stays untouched, minding its own business. πTIFFSwabArrayOfShort()andTIFFSwabArrayOfLong(),TIFFSwabArrayOfFloat()β swap the bytes in an array of 16- and 32-bit items, respectively.TIFFSwabArrayOfLong8()andTIFFSwabArrayOfDouble()β swap the bytes in an array of 64-bit items.
and then there's TIFFReverseBits() π« β it replaces each byte in data with the equivalent bit-reversed value. this operation is performed with a lookup table, which is returned using the TIFFGetBitRevTable() function.
the reversed parameter specifies which table should be returned, so listen up:
- Supply
1if you want the bit reversal table. - Supply
0to get the table that does not reverse bit values. it's a lookup table that can be used as an "identity function"; i.e.TIFFNoBitRevTable[n] == n.
fr fr, pick your table wisely β1flips,0does absolutely nothing and that's the whole point of it. π
π DIAGNOSTICS π
None.
likeβ¦ none at all. no drama, no error codes, nothing. she's silent. π€«
π SEE ALSO π
libtiff (3tiff)
π«Ά AUTHOR π«Ά
LibTIFF contributors
π COPYRIGHT π
1988-2025, LibTIFF contributors
and that's the whole page, bestie β slay π this was LibTIFF version 4.7, dated Jun 27, 2026, and yes she ate, periodt. β¨π§π
π¦ where this page comes from
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-1.fc43
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 43: libtiff-devel 4.7.2-3.fc43 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-1.fc44
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- fedora 44: libtiff-devel 4.7.2-3.fc44 Β· libtiff
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms