cpu_capabilities(3)
π cpu_capabilities(3) β the Allegro manual, but make it cute β¨
okay bestie, sit down, we're talking about cpu_capabilities β a little global from the Allegro game programming library that tells you what your CPU can actually do. it's giving "tell me your red flags but it's processor instructions" π
πΈ SYNOPSIS πΈ
#include <allegro.h>
extern int cpu_capabilities;
like. that's it. one extern int. she's lowkey simple but highkey important π
β¨ DESCRIPTION β¨
so cpu_capabilities holds a bunch of CPU flags that say which features your current CPU has. and not just one β it can be any combination of these, all OR-ed together in one int. let's go through the whole roster, no skipping, periodt π
CPU_IDβ this one means the"cpuid"instruction is available. and bestie, this matters: if this flag is set, then all Allegro CPU variables are 100% reliable. if it's not set? there may be some mistakes π so if you don't seeCPU_ID, don't be out here trusting everything you read, okay?CPU_FPUβ an FPU is available π« (floating point, she's here)CPU_IA64β running on an Intel 64 bit CPUCPU_AMD64β running on an AMD 64 bit CPUCPU_MMXβ Intel MMX instruction set is available π₯CPU_MMXPLUSβ Intel MMX+ instruction set is availableCPU_SSEβ Intel SSE instruction set is available β¨CPU_SSE2β Intel SSE2 instruction set is available β¨CPU_SSE3β Intel SSE3 instruction set is available β¨CPU_3DNOWβ AMD 3DNow! instruction set is availableCPU_ENH3DNOWβ AMD Enhanced 3DNow! instruction set is availableCPU_CMOVβ Pentium Pro"cmov"instruction is available
π¦ how to actually use her π¦
you check for multiple features by OR-ing the flags together. iconic behaviour honestly.
so for example, if you wanna know whether the CPU has both an FPU and MMX instructions, you'd do:
if ((cpu_capabilities & (CPU_FPU | CPU_MMX)) ==
(CPU_FPU | CPU_MMX)) {
printf("CPU has both an FPU and MMX instructions!\n");
}
see the double-check on both sides of the ==? that's not a typo, that's the vibe check β you're making sure every flag you asked for is actually present, not just one of them π
and like, you can only read this variable after you've calledcheck_cpu()β which, good news, gets automatically called byallegro_init()for you. so if you did yourallegro_init(), you're covered, no extra steps required π
π SEE ALSO π
check_cpu(3)cpu_vendor(3)cpu_family(3)cpu_model(3)cpu_capabilities(3)β yes she's referencing herself, main character energy fr fr πallegro_init(3)
and that's the whole page, bestie π«Ά this was Allegro, version 4.4.3, and we've been reading cpu_capabilities(3) β go forth and check your flags, you ate πβ¨π
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms