]> git.ayabusa.dev Git - thoryum.git/commitdiff
Added cpu name helper
authorAyabusa <lebgpub@gmail.com>
Thu, 4 Jun 2026 18:49:55 +0000 (20:49 +0200)
committerAyabusa <lebgpub@gmail.com>
Thu, 4 Jun 2026 18:49:55 +0000 (20:49 +0200)
src/cpu.c
src/cpu.h

index 33cfdeb1ea7025650788f56c5fd99e4a86901397..791b964a9df5dd2dd37e8659686d48fbe910941c 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -1,4 +1,5 @@
 #include <cpuid.h>
+#include <string.h>
 #include "cpu.h"
 
 // Great article https://wiki.osdev.org/CPUID
@@ -18,3 +19,16 @@ enum CPU_opti CPU_fetch_opti() {
        else
                return POTATO; // Bruh... You in the 50s or wat ?
 }
+
+void CPU_opti_name(char[5] buf, enum CPU_opti opti) {
+       if (opti == AVX2)
+               strcpy(buf, "AVX2");
+       else if (opti == AVX)
+               strcpy(buf, "AVX\0");
+       else if (opti == SSE4)
+               strcpy(buf, "SSE4");
+       else if (opti == SSE3)
+               strcpy(buf, "SSE3");
+       else
+               strcpy(buf, "i386");
+}
index b6ee41502e168cf17886484c09335854d5b4d88f..dd7eeb8f63a177a8806f036785bc0045ece3e20a 100644 (file)
--- a/src/cpu.h
+++ b/src/cpu.h
@@ -10,5 +10,6 @@ enum CPU_opti {
 };
 
 enum CPU_opti CPU_fetch_opti();
+void CPU_opti_name(char[5] buf, enum CPU_opti opti);
 
 #endif