cpu_model(3alleg4)

πŸ’– cpu_model β€” the Intel CPU submodel, bestie πŸ’–

okay so this is a page from the Allegro game programming library manual, section 3alleg4, and it's all about one lil global variable that tells you exactly which flavor of CPU you're running on. no cap. 🧚✨


✨ SYNOPSIS ✨

#include <allegro.h>

extern int cpu_model;

🌸 DESCRIPTION 🌸

so cpu_model holds the CPU submodel, where applicable. that's it, that's the vibe. πŸ’…

Allegro defines at least these CPU family types (and if you want the full tea, go peek at include/allegro/system.h for a more complete list πŸ‘€):

  • CPU_FAMILY_I586:
    • CPU_MODEL_PENTIUM, CPU_MODEL_K5, CPU_MODEL_K6
  • CPU_FAMILY_I686:
    • CPU_MODEL_PENTIUMPRO, CPU_MODEL_PENTIUMII, CPU_MODEL_PENTIUMIIIKATMAI, CPU_MODEL_PENTIUMIIICOPPERMINE, CPU_MODEL_ATHLON, CPU_MODEL_DURON
  • CPU_FAMILY_EXTENDED:
    • CPU_MODEL_PENTIUMIV, CPU_MODEL_XEON, CPU_MODEL_ATHLON64, CPU_MODEL_OPTERON
  • CPU_FAMILY_POWERPC:
    • CPU_MODEL_POWERPC_x, for x=601-604, 620, 750, 7400, 7450
🫢 real talk though: you can only read this variable after you've called check_cpu() β€” which, good news, gets called automatically by allegro_init(). so if you skipped allegro_init() you're gonna have a bad time, bestie. 😭

also make sure you check cpu_family and cpu_vendor first, so you actually know which models make sense to check. it's giving "read the room before you read the variable" fr fr. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€


and that's the whole page, periodt. πŸ’– this little baddie shipped with Allegro, version 4.4.3 β€” iconic behavior honestly, we stan a stable release. πŸŒˆπŸ’œπŸ¦‹