From cb186a2f973ece4fcd1a19a9c6ff87741a40c517 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Fri, 2 Aug 2024 10:09:51 +0100 Subject: [PATCH] [v1.05][X86] Do not show empty SSE if not supported (#260) --- src/common/printer.c | 5 +++-- src/x86/cpuid.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/common/printer.c b/src/common/printer.c index ff2ec53..6973ea8 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -634,9 +634,10 @@ bool print_cpufetch_x86(struct cpuInfo* cpu, STYLE s, struct color** cs, struct } // Show the most modern vector instructions. - // If AVX is supported show it, otherwise show SSE if (strcmp(avx, "No") == 0) { - setAttribute(art, ATTRIBUTE_SSE, sse); + if (strcmp(sse, "No") != 0) { + setAttribute(art, ATTRIBUTE_SSE, sse); + } } else { setAttribute(art, ATTRIBUTE_AVX, avx); diff --git a/src/x86/cpuid.c b/src/x86/cpuid.c index 5d993c9..5d9a841 100644 --- a/src/x86/cpuid.c +++ b/src/x86/cpuid.c @@ -1096,8 +1096,14 @@ char* get_str_sse(struct cpuInfo* cpu) { last+=SSE4_2_sl; } - //Purge last comma - string[last-1] = '\0'; + if (last == 0) { + snprintf(string, 2+1, "No"); + } + else { + //Purge last comma + string[last-1] = '\0'; + } + return string; }