CK_PR_XOR(3)

✨ CK_PR_XOR(3) ✨

okay bestie, pull up a chair, we're talking about ck_pr_xor from the Concurrency Kit manual, section 3. it's giving "atomic bitwise-xor operations" and honestly? iconic. no cap. πŸ’…


🌸 NAME 🌸

ck_pr_xor_ptr, ck_pr_xor_char, ck_pr_xor_uint, ck_pr_xor_int, ck_pr_xor_64, ck_pr_xor_32, ck_pr_xor_16, ck_pr_xor_8 β€” atomic bitwise-xor operations πŸ¦‹βœ¨

like. the whole squad. eight little functions all doing the xor thing but for different types. main character energy fr fr.


πŸŽ€ LIBRARY πŸŽ€

Concurrency Kit (that's libck, you link it with -lck) 🫢


πŸ’– SYNOPSIS πŸ’–

#include <ck_pr.h>

void
ck_pr_xor_ptr(void *target, uintptr_t delta);

void
ck_pr_xor_char(char *target, char delta);

void
ck_pr_xor_uint(unsigned int *target, unsigned int delta);

void
ck_pr_xor_int(int *target, int delta);

void
ck_pr_xor_64(uint64_t *target, uint64_t delta);

void
ck_pr_xor_32(uint32_t *target, uint32_t delta);

void
ck_pr_xor_16(uint16_t *target, uint16_t delta);

void
ck_pr_xor_8(uint8_t *target, uint8_t delta);

look at them. a whole lineup. one for every size you could possibly need, bestie. _ptr, _char, _uint, _int, then the number crew: _64, _32, _16, _8. pick your fighter. πŸŽ€


✨ DESCRIPTION ✨

so here's the tea. 🍡

the ck_pr_xor(3) family of functions atomically compute and store the result of a bitwise-xor of the value pointed to by target and delta into the value pointed to by target.

read that again, because the key word is atomically πŸ’€ β€” you're not doing read-modify-write by hand and praying no other thread body-checks your value in between. it's one atomic op. it just happens. and the result lands right back in target, where it started. it's giving "in and out, twenty minute adventure". πŸ¦‹


🌈 RETURN VALUES 🌈

this family of functions does not have a return value.

nothing. void. zero. it's not returning your texts, bestie 😭 it just does the xor and dips. πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ

the whole extended universe, no gatekeeping:

Additional information available at http://concurrencykit.org/ 🌐

okay and that's the whole page, bestie. this one's from April 11, 2013 and it's page ck_pr_xor(3) β€” go forth and xor atomically, you absolute legend. slay. πŸ‘‘πŸ’–βœ¨

πŸ“¦ where this page comes from