libwget-bitmap(3)

πŸ’– libwget-bitmap(3) πŸ’–

okay bestie, welcome to the libwget-bitmap page from the Library Functions Manual β€” yes it's a manual page, yes we're making it cute, and yes every single flag, macro and signature is staying exactly where it belongs. no cap. πŸŽ€


✨ NAME ✨

libwget-bitmap β€” bitmap management functions πŸ’…

Like, it's the whole vibe of managing bitmaps. That's the job. That's the girlboss.


🌈 SYNOPSIS 🌈

πŸ¦‹ Data Structures

struct wget_bitmap_st

🧚 Macros

#define bitmap_type   uint64_t
#define bitmap_bits   (sizeof(bitmap_type) * 8)
#define bitmap_shift   6
#define map(n)
#define bit(n)

⭐ Functions

void wget_bitmap_set (wget_bitmap *b, unsigned n)
void wget_bitmap_clear (wget_bitmap *b, unsigned n)
bool wget_bitmap_get (const wget_bitmap *b, unsigned n)
int wget_bitmap_init (wget_bitmap **b, unsigned bits)
void wget_bitmap_free (wget_bitmap **b)

🌸 Detailed Description 🌸

It's a bitmap (aka bit array) implementation. iconic behavior honestly.

Bestie, here's when you need her: this is useful when you need a bitmap with more than 64 bits. Up to 64 bits you can just use the C99 uint64_t as a standard C bitfield and call it a day. but if you want more? she's right there. 🫢

As a usage example, Wget2 uses bitmaps for options with lists of HTTP status codes, which have values of 100-699. so yeah, real ones use it.


πŸ’œ Macro Definition Documentation πŸ’œ

πŸ“ #define map( n)

Value:

(((wget_bitmap *)b)->map[(n) >> bitmap_shift])

πŸŽ€ #define bit( n)

Value:

(((bitmap_type) 1) << ((n) & (bitmap_bits - 1)))

πŸ”₯ Function Documentation πŸ”₯

πŸ‘‘ void wget_bitmap_set (wget_bitmap * b, unsigned n)

Parameters

  • b β€” Bitmap to act on
  • n β€” Number of the bit to set (0-...)

Set the bit n in the bitmap b. that's it, that's the whole function, and she ate. πŸ’…


✨ void wget_bitmap_clear (wget_bitmap * b, unsigned n)

Parameters

  • b β€” Bitmap to act on
  • n β€” Number of the bit to clear (0-...)

Clear the bit n in the bitmap b. unsetting, but make it fashion. πŸ’–


🌈 bool wget_bitmap_get (const wget_bitmap * b, unsigned n)

Parameters

  • b β€” Bitmap to read from
  • n β€” Number of the bit of interest (0-...)

Returns

0 if bit n is cleared or if n is out of range, 1 if bit is set

Returns whether the bit n is set or not. literally just a vibe check on one single bit. πŸ¦‹


🧚 int wget_bitmap_init (wget_bitmap ** b, unsigned bits)

Parameters

  • b β€” Pointer to the allocated bitmap
  • bits β€” Number of bits

Returns

A wget_error value

Allocates a bitmap with a capacity of bits. It must be freed by wget_bitmap_free() after usage.

bestie. do not forget the free. she is not self-cleaning. 😭

πŸ’€ void wget_bitmap_free (wget_bitmap ** b)

Parameters

  • b β€” Pointer to bitmap to free

Frees and clears the bitmap pointed to by b. clean up your room, queen. πŸ™ˆ


🌟 Author 🌟

Generated automatically by Doxygen for wget2 from the source code. not a human, just a robot doing her little tasks. πŸ€–πŸ’…


and that's the whole page, periodt. πŸŽ€ this beauty ships with wget2, Version 2.3.0 β€” mwah, take care of her, and don't leak the bitmap. πŸ’–βœ¨

πŸ“¦ where this page comes from