FBB::Field(3bobcat)

πŸ’– FBB::Field(3bobcat) πŸ’–

okay so welcome to the Field page of the bobcat man pages, bestie, this one is literally about number fields and it's so much cooler than it sounds, trust πŸ’…


✨ NAME ✨

FBB::Field β€” sets and retrieves offset based number fields 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <bobcat/field>

πŸ’œ DESCRIPTION πŸ’œ

ngl numbers can have offset-based sub-fields hiding inside them and nobody talks about it. like, a value like 12345 might lowkey consist of the fields 12 and 345. these are what we call offset-based fields, and you talk about them using end- and begin offsets in the number representations. in that example, 345 begins at digit position 0 (which is the least significant digit of 12345, iykyk) and at digit position 3 the next field starts. same energy, the field 12 begins at digit position 3 and has ended at digit position 5. iconic behaviour fr fr.

the Field class template is your girl for retrieving and assigning position based values of existing numeric values of (currently) at most 64 bits. periodt.

to represent such fields the following format is used:

Field<base, end, begin>::function(argument(s))

where base specifies the number system’s base value, end specifies the (0-based) index position where the number field ends, and begin specifies the index position where the number field begins. here are two examples using the decimal number system, because we're feeling basic today:

Field<10, 3, 0>::get(12345)    // returns 345
Field<10, 5, 3>::get(12345)    // returns  12

now why is end before begin? the absolute tea: the decision to specify the end offset before (i.e., left of) the begin offset is based on the consideration that this corresponds to the standard way of looking at digit positions in numbers, where the end offset is found to the left of the begin offset. so it's not chaos, it's ✨intentional✨.

values of fields can be retrieved, but they can also be set, and to set a field’s value the following format is used:

Field<10, 3, 1>::set(12345, 99)   // returns 12995
Field<10, 1, 0>::set(12345, 0)    // returns 12450

when values are assigned to fields the maximum width of the destination field is taken into account, bestie. so when you specify 9999 instead of 99 in the above example, the returned value will still be 12995, because the destination field has a width of two digit positions and it simply does not care about your extra digits. likewise, specifying a smaller value sets the remaining (more significant) digits to 0:

Field<10, 3, 1>::set(12345, 9)    // returns 12095

the class templates themselves are unaware of bases of number systems. since 0xdeaf equals the decimal value 57007 and 0xd equals 13, calling the above function as

Field<16, 1, 0>::set(76007, 13)

returns the hexadecimal value 0xdead’.

the Field class template requires three non-type numeric arguments, no more no less:

  • base, specifying the base of the number system;
  • end, specifying the 0-based offset of the digit position where the field has ended;
  • begin, specifying the 0-based offset of the digit position where the field begins;

and the glow-up: the class template is specialized for situations where base is a mere power of 2 (like 2, 4, 8, 16, ...) because in those cases bit-operations can be used which are faster than multiplications, divisions and modulo computation which are required when other number system bases are used. we love a performance queen πŸ‘‘


🌈 NAMESPACE 🌈

FBB

all constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB. 🫢


πŸŽ€ INHERITS FROM πŸŽ€

  • -

(yes literally nothing, she's self-made πŸ’…)


⭐ MEMBER FUNCTIONS ⭐

  • uint64_t Field<base, end, begin>::get(uint64_t value) β€” value is interpreted as a value in the base number system, and using digit positions in that number system the value of the digits from offset begin to (but not including) offset end is returned. giving "not me extracting exactly the digits you asked for" energy.
  • uint64_t Field<base, end, begin>::set(uint64_t value, uint64_t field) β€” value is interpreted as a value in the base number system, and using digit positions in that number system the digits from offset begin to (but not including) offset end are replaced by field’s value. when the number of field's digits (also using number system base) exceeds end - begin then those excess digits are ignored. bestie they are simply not invited to the party πŸ™ˆ

🌸 EXAMPLE 🌸

see the examples in the DESCRIPTION section. they're right up there, go look, I'll wait 🧚


πŸ“ FILES πŸ“

bobcat/field β€” defines the class interface


πŸ’« SEE ALSO πŸ’«

bobcat(7)


πŸ’€ BUGS πŸ’€

None Reported.


πŸ‘‘ BOBCAT PROJECT FILES πŸ‘‘

Debian Bobcat project files:

  • libbobcat6: debian package containing the shared library, changelog and copyright note;
  • libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;

πŸ¦‹ BOBCAT πŸ¦‹

Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’. main character naming rights fr fr.


This is free software, distributed under the terms of the GNU General Public License (GPL). 🫢


✨ AUTHOR ✨

Frank B. Brokken (f.b.brokken@rug.nl).


and that's the whole vibe, bestie πŸ’– this was libbobcat-dev_6.15.01, dated 2005-2026, and it lives in the FBB::Field(3bobcat) manual. slay, go set some fields, no cap πŸŒˆβ­πŸŽ€

πŸ“¦ where this page comes from