[haiku-commits] haiku: hrev44225 - src/tools headers/os/kernel headers/private/shared src/system/kernel/arch/x86

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 5 Jun 2012 00:05:41 +0200 (CEST)

hrev44225 adds 3 changesets to branch 'master'
old head: 76f066c2a103c6e018f0ecb475aaadfa37f6c087
new head: 966df2f98b509218c8743d9b468bb0929e6aa00f

----------------------------------------------------------------------------

bd12d75: cpuid: consolidate tools to one tool
  
  * Don't move vendor mask
  * Place extended cpu info before vendor *if* amd
    cpu family == 0xF

548b1a4: cpuid: Rework AMD CPUID numbers
  
  * If family is 0xF, we grab extended family and model
    like Intel does
  * Idenfify AMD cpu's more correctly

966df2f: cpuidtool: Style cleanup

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

5 files changed, 147 insertions(+), 177 deletions(-)
headers/os/kernel/OS.h                          |   91 +++++++++++-------
headers/private/shared/cpu_type.h               |   51 ++++++++--
src/system/kernel/arch/x86/arch_system_info.cpp |   12 +--
src/tools/{amdcpuid.c => cpuidtool.c}           |   74 +++++++-------
src/tools/intelcpuid.c                          |   96 -------------------

############################################################################

Commit:      bd12d75f964cdfcda2938aedb88b39a73aa35f0c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bd12d75
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Mon Jun  4 17:34:36 2012 UTC

cpuid: consolidate tools to one tool

* Don't move vendor mask
* Place extended cpu info before vendor *if* amd
  cpu family == 0xF

----------------------------------------------------------------------------

diff --git a/src/tools/amdcpuid.c b/src/tools/amdcpuid.c
deleted file mode 100644
index 9c2500e..0000000
--- a/src/tools/amdcpuid.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2012 Haiku, Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- *             Alexander von Gluck, kallisti5@xxxxxxxxxxx
- */
-
-/*
- * Pass an AMD CPUID in hex, and get out a CPUID for OS.h
- */
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-
-#define AMD_VENDOR 0x110000
-
-#define EXT_FAMILY_MASK 0xF00000
-#define EXT_MODEL_MASK 0x0F0000
-#define FAMILY_MASK            0x000F00
-#define MODEL_MASK             0x0000F0
-#define STEPPING_MASK  0x00000F
-
-
-// Converts a hexadecimal string to integer
-static int xtoi(const char* xs, unsigned int* result)
-{
-       size_t szlen = strlen(xs);
-       int i, xv, fact;
-
-       if (szlen > 0) {
-               // Converting more than 32bit hexadecimal value?
-               if (szlen>8) return 2; // exit
-
-               // Begin conversion here
-               *result = 0;
-               fact = 1;
-
-               // Run until no more character to convert
-               for (i = szlen - 1; i>=0 ;i--) {
-                       if (isxdigit(*(xs+i))) {
-                               if (*(xs+i)>=97) {
-                                       xv = ( *(xs+i) - 97) + 10;
-                               } else if ( *(xs+i) >= 65) {
-                                       xv = (*(xs+i) - 65) + 10;
-                               } else {
-                                       xv = *(xs+i) - 48;
-                               }
-                               *result += (xv * fact);
-                               fact *= 16;
-                       } else {
-                               // Conversion was abnormally terminated
-                               // by non hexadecimal digit, hence
-                               // returning only the converted with
-                               // an error value 4 (illegal hex character)
-                               return 4;
-                       }
-               }
-       }
-
-       // Nothing to convert
-       return 1;
-}
-
-
-int
-main(int argc, char *argv[])
-{
-       if (argc != 2) {
-               printf("Provide the AMD cpuid in hex, and you will get how we 
id it\n");
-               printf("usage: amdcpuid <cpuid_hex>\n");
-               return 1;
-       }
-
-       unsigned int cpuid;
-       xtoi(argv[1], &cpuid);
-
-       printf("cpuid: 0x%X\n", cpuid);
-
-       unsigned int extFam = (cpuid & EXT_FAMILY_MASK) >> 20;
-       unsigned int extMod = (cpuid & EXT_MODEL_MASK) >> 16;
-       unsigned int family = (cpuid & FAMILY_MASK) >> 8;
-       unsigned int model = (cpuid & MODEL_MASK) >> 4;
-       unsigned int stepping = (cpuid & STEPPING_MASK);
-
-       unsigned int amdFamily = 0;
-       unsigned int amdModel = 0;
-       if (family == 0xF) {
-               amdFamily = extFam + family;
-               amdModel = (extMod << 4) + model;
-       } else {
-               amdFamily = family;
-               amdModel = model;
-       }
-
-       // Haiku AMD cpuid format: VVFFMM
-       unsigned int amdHaiku
-               = AMD_VENDOR + (amdFamily << 8) + amdModel;
-
-       printf("family: 0x%lX\n", amdFamily);
-       printf("model: 0x%lX\n", amdModel);
-       printf("stepping: 0x%lX\n", stepping);
-       printf("Haiku CPUID: 0x%lX\n", amdHaiku);
-
-       return 0;
-}
diff --git a/src/tools/intelcpuid.c b/src/tools/cpuidtool.c
similarity index 69%
rename from src/tools/intelcpuid.c
rename to src/tools/cpuidtool.c
index 44e3e4c..b7837e8 100644
--- a/src/tools/intelcpuid.c
+++ b/src/tools/cpuidtool.c
@@ -16,8 +16,6 @@
 #include <string.h>
 
 
-#define INTEL_VENDOR 0x100000
-
 #define EXT_FAMILY_MASK 0xF00000
 #define EXT_MODEL_MASK 0x0F0000
 #define FAMILY_MASK            0x000F00
@@ -69,14 +67,14 @@ static int xtoi(const char* xs, unsigned int* result)
 int
 main(int argc, char *argv[])
 {
-       if (argc != 2) {
-               printf("Provide the Intel cpuid in hex, and you will get how we 
id it\n");
-               printf("usage: intelcpuid <cpuid_hex>\n");
+       if (argc != 3) {
+               printf("Provide the cpuid in hex, and you will get how we id 
it\n");
+               printf("usage: cpuidhaiku <AMD|INTEL> <cpuid_hex>\n");
                return 1;
        }
 
-       unsigned int cpuid;
-       xtoi(argv[1], &cpuid);
+       unsigned int cpuid = 0;
+       xtoi(argv[2], &cpuid);
 
        printf("cpuid: 0x%X\n", cpuid);
 
@@ -86,11 +84,24 @@ main(int argc, char *argv[])
        unsigned int model = (cpuid & MODEL_MASK) >> 4;
        unsigned int stepping = (cpuid & STEPPING_MASK);
 
-       // Haiku INTEL cpuid format: VVEFEM
-       unsigned int intelHaiku = INTEL_VENDOR + ((extFam & 0xF) << 12)
-               + (family << 8) + (extMod << 4) + model;
+       unsigned int cpuidHaiku;
+       if (strncmp(argv[1], "AMD", 3) == 0) {
+               if (family == 0xF) {
+                       cpuidHaiku = (extFam << 20) + (extMod << 16)
+                               + (family << 4) + model;
+               } else
+                       cpuidHaiku = (family << 4) + model;
+               cpuidHaiku += 0x1100; // AMD vendor id
+       } else if (strncmp(argv[1], "INTEL", 5) == 0) {
+               cpuidHaiku = (extFam << 20) + (extMod << 16)
+                       + (family << 4) + model;
+               cpuidHaiku += 0x1000; // Intel vendor id
+       } else {
+               printf("Vendor should be AMD or INTEL\n");
+               return 1;
+       }
 
-       printf("Haiku CPUID: 0x%lX\n", intelHaiku);
+       printf("Haiku CPUID: 0x%lx\n", cpuidHaiku);
 
        return 0;
 }

############################################################################

Commit:      548b1a49889120dd46ef01d133a44b69d7659218
URL:         http://cgit.haiku-os.org/haiku/commit/?id=548b1a4
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Mon Jun  4 19:11:43 2012 UTC

cpuid: Rework AMD CPUID numbers

* If family is 0xF, we grab extended family and model
  like Intel does
* Idenfify AMD cpu's more correctly

----------------------------------------------------------------------------

diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h
index 383f857..1f921f9 100644
--- a/headers/os/kernel/OS.h
+++ b/headers/os/kernel/OS.h
@@ -494,7 +494,7 @@ typedef enum cpu_types {
        B_CPU_INTEL_PENTIUM_M                           = 0x1069,
        B_CPU_INTEL_PENTIUM_III_XEON            = 0x106a,
        B_CPU_INTEL_PENTIUM_III_MODEL_11        = 0x106b,
-       B_CPU_INTEL_ATOM                        = 0x1106c,
+       B_CPU_INTEL_ATOM                                        = 0x1106c,
        B_CPU_INTEL_PENTIUM_M_MODEL_13          = 0x106d, /* Dothan */
        B_CPU_INTEL_PENTIUM_CORE,
        B_CPU_INTEL_PENTIUM_CORE_2,
@@ -513,15 +513,14 @@ typedef enum cpu_types {
 
        /* AMD */
 
-       /* Checked with "AMD Processor Recognition Application Note"
-        * (Table 3)
-        * 20734.pdf
-        */
+       // AMD Processor Recognition Application Note
        B_CPU_AMD_x86                                           = 0x1100,
+
+       // Family 5h
        B_CPU_AMD_K5_MODEL_0                            = 0x1150,
-       B_CPU_AMD_K5_MODEL_1,
-       B_CPU_AMD_K5_MODEL_2,
-       B_CPU_AMD_K5_MODEL_3,
+       B_CPU_AMD_K5_MODEL_1                            = 0x1151,
+       B_CPU_AMD_K5_MODEL_2                            = 0x1152,
+       B_CPU_AMD_K5_MODEL_3                            = 0x1153,
        B_CPU_AMD_K6_MODEL_6                            = 0x1156,
        B_CPU_AMD_K6_MODEL_7                            = 0x1157,
        B_CPU_AMD_K6_MODEL_8                            = 0x1158,
@@ -530,42 +529,70 @@ typedef enum cpu_types {
        B_CPU_AMD_K6_III                                        = 0x1159,
        B_CPU_AMD_K6_III_MODEL_13                       = 0x115d,
 
+       B_CPU_AMD_GEODE_LX                                      = 0x115a,
+
+       // Family 6h
        B_CPU_AMD_ATHLON_MODEL_1                        = 0x1161,
        B_CPU_AMD_ATHLON_MODEL_2                        = 0x1162,
 
        B_CPU_AMD_DURON                                         = 0x1163,
 
        B_CPU_AMD_ATHLON_THUNDERBIRD            = 0x1164,
-       B_CPU_AMD_ATHLON_XP                             = 0x1166,
-       B_CPU_AMD_ATHLON_XP_MODEL_7,
-       B_CPU_AMD_ATHLON_XP_MODEL_8,
+       B_CPU_AMD_ATHLON_XP_MODEL_6                     = 0x1166,
+       B_CPU_AMD_ATHLON_XP_MODEL_7                     = 0x1167,
+       B_CPU_AMD_ATHLON_XP_MODEL_8                     = 0x1168,
        B_CPU_AMD_ATHLON_XP_MODEL_10            = 0x116a, /* Barton */
 
-       B_CPU_AMD_SEMPRON_MODEL_8                       = 
B_CPU_AMD_ATHLON_XP_MODEL_8,
-       B_CPU_AMD_SEMPRON_MODEL_10                      = 
B_CPU_AMD_ATHLON_XP_MODEL_10,
-
-       /* According to "Revision Guide for AMD Family 10h
-        * Processors" (41322.pdf)
-        */
-       B_CPU_AMD_PHENOM                                        = 0x11f2,
-
-       /* According to "Revision guide for AMD Athlon 64
-        * and AMD Opteron Processors" (25759.pdf)
-        */
+       // Family fh
        B_CPU_AMD_ATHLON_64_MODEL_3                     = 0x11f3,
-       B_CPU_AMD_ATHLON_64_MODEL_4,
-       B_CPU_AMD_ATHLON_64_MODEL_5,
-       B_CPU_AMD_PHENOM_II                                     = 
B_CPU_AMD_ATHLON_64_MODEL_4,
-       B_CPU_AMD_OPTERON                                       = 
B_CPU_AMD_ATHLON_64_MODEL_5,
-       B_CPU_AMD_ATHLON_64_FX                          = 
B_CPU_AMD_ATHLON_64_MODEL_5,
+       B_CPU_AMD_ATHLON_64_MODEL_4                     = 0x11f4,
        B_CPU_AMD_ATHLON_64_MODEL_7                     = 0x11f7,
-       B_CPU_AMD_ATHLON_64_MODEL_8,
+       B_CPU_AMD_ATHLON_64_MODEL_8                     = 0x11f8,
        B_CPU_AMD_ATHLON_64_MODEL_11            = 0x11fb,
-       B_CPU_AMD_ATHLON_64_MODEL_12,
+       B_CPU_AMD_ATHLON_64_MODEL_12            = 0x11fc,
        B_CPU_AMD_ATHLON_64_MODEL_14            = 0x11fe,
-       B_CPU_AMD_ATHLON_64_MODEL_15,
-
-       B_CPU_AMD_GEODE_LX                                      = 0x115a,
+       B_CPU_AMD_ATHLON_64_MODEL_15            = 0x11ff,
+       B_CPU_AMD_ATHLON_64_MODEL_20            = 0x111f4,
+       B_CPU_AMD_ATHLON_64_MODEL_23            = 0x111f7,
+       B_CPU_AMD_ATHLON_64_MODEL_24            = 0x111f8,
+       B_CPU_AMD_ATHLON_64_MODEL_27            = 0x111fb,
+       B_CPU_AMD_ATHLON_64_MODEL_28            = 0x111fc,
+       B_CPU_AMD_ATHLON_64_MODEL_31            = 0x111ff,
+       B_CPU_AMD_ATHLON_64_MODEL_35            = 0x211f3,
+       B_CPU_AMD_ATHLON_64_MODEL_43            = 0x211fb,
+       B_CPU_AMD_ATHLON_64_MODEL_44            = 0x211fc,
+       B_CPU_AMD_ATHLON_64_MODEL_47            = 0x211ff,
+       B_CPU_AMD_ATHLON_64_MODEL_63            = 0x311ff,
+       B_CPU_AMD_ATHLON_64_MODEL_79            = 0x411ff,
+       B_CPU_AMD_ATHLON_64_MODEL_95            = 0x511ff,
+       B_CPU_AMD_ATHLON_64_MODEL_127           = 0x711ff,
+
+       B_CPU_AMD_OPTERON_MODEL_5                       = 0x11f5,
+       B_CPU_AMD_OPTERON_MODEL_21                      = 0x111f5,
+       B_CPU_AMD_OPTERON_MODEL_33                      = 0x211f1,
+       B_CPU_AMD_OPTERON_MODEL_37                      = 0x211f5,
+       B_CPU_AMD_OPTERON_MODEL_39                      = 0x211f7,
+
+       B_CPU_AMD_TURION_64_MODEL_36            = 0x211f4,
+       B_CPU_AMD_TURION_64_MODEL_76            = 0x411fc,
+       B_CPU_AMD_TURION_64_MODEL_104           = 0x611f8,
+
+       // Family 10h
+       B_CPU_AMD_PHENOM_MODEL_2                        = 0x1011f2,
+       B_CPU_AMD_PHENOM_II_MODEL_4                     = 0x1011f4,
+       B_CPU_AMD_PHENOM_II_MODEL_5                     = 0x1011f5,
+       B_CPU_AMD_PHENOM_II_MODEL_6                     = 0x1011f6,
+       B_CPU_AMD_PHENOM_II_MODEL_10            = 0x1011fa,
+
+       // Family 12h
+       B_CPU_AMD_A_SERIES                                      = 0x3011f1,
+
+       // Family 14h
+       B_CPU_AMD_C_SERIES                                      = 0x5011f1,
+       B_CPU_AMD_E_SERIES                                      = 0x5011f2,
+
+       // Family 15h
+       B_CPU_AMD_FX_SERIES                                     = 0x6011f1, /* 
Bulldozer */
 
        /* VIA/Cyrix */
        B_CPU_CYRIX_x86                                         = 0x1200,
diff --git a/headers/private/shared/cpu_type.h 
b/headers/private/shared/cpu_type.h
index c3a7fb9..2c1f7c6 100644
--- a/headers/private/shared/cpu_type.h
+++ b/headers/private/shared/cpu_type.h
@@ -232,33 +232,70 @@ get_cpu_model_string(system_info *info)
                case B_CPU_AMD_K6_III:
                case B_CPU_AMD_K6_III_MODEL_13:
                        return "K6-III";
+               case B_CPU_AMD_GEODE_LX:
+                       return "Geode LX";
                case B_CPU_AMD_ATHLON_MODEL_1:
                case B_CPU_AMD_ATHLON_MODEL_2:
                case B_CPU_AMD_ATHLON_THUNDERBIRD:
                        return "Athlon";
-               case B_CPU_AMD_ATHLON_XP:
+               case B_CPU_AMD_ATHLON_XP_MODEL_6:
+               case B_CPU_AMD_ATHLON_XP_MODEL_7:
                case B_CPU_AMD_ATHLON_XP_MODEL_8:
                case B_CPU_AMD_ATHLON_XP_MODEL_10:
                        return "Athlon XP";
                case B_CPU_AMD_DURON:
-               case B_CPU_AMD_ATHLON_XP_MODEL_7:
                        return "Duron";
                case B_CPU_AMD_ATHLON_64_MODEL_3:
+               case B_CPU_AMD_ATHLON_64_MODEL_4:
                case B_CPU_AMD_ATHLON_64_MODEL_7:
                case B_CPU_AMD_ATHLON_64_MODEL_8:
                case B_CPU_AMD_ATHLON_64_MODEL_11:
                case B_CPU_AMD_ATHLON_64_MODEL_12:
                case B_CPU_AMD_ATHLON_64_MODEL_14:
                case B_CPU_AMD_ATHLON_64_MODEL_15:
+               case B_CPU_AMD_ATHLON_64_MODEL_20:
+               case B_CPU_AMD_ATHLON_64_MODEL_23:
+               case B_CPU_AMD_ATHLON_64_MODEL_24:
+               case B_CPU_AMD_ATHLON_64_MODEL_27:
+               case B_CPU_AMD_ATHLON_64_MODEL_28:
+               case B_CPU_AMD_ATHLON_64_MODEL_31:
+               case B_CPU_AMD_ATHLON_64_MODEL_35:
+               case B_CPU_AMD_ATHLON_64_MODEL_43:
+               case B_CPU_AMD_ATHLON_64_MODEL_44:
+               case B_CPU_AMD_ATHLON_64_MODEL_47:
+               case B_CPU_AMD_ATHLON_64_MODEL_63:
+               case B_CPU_AMD_ATHLON_64_MODEL_79:
+               case B_CPU_AMD_ATHLON_64_MODEL_95:
+               case B_CPU_AMD_ATHLON_64_MODEL_127:
                        return "Athlon 64";
-               case B_CPU_AMD_OPTERON:
+               case B_CPU_AMD_OPTERON_MODEL_5:
+               case B_CPU_AMD_OPTERON_MODEL_21:
+               case B_CPU_AMD_OPTERON_MODEL_33:
+               case B_CPU_AMD_OPTERON_MODEL_37:
+               case B_CPU_AMD_OPTERON_MODEL_39:
                        return "Opteron";
-               case B_CPU_AMD_PHENOM:
+               case B_CPU_AMD_TURION_64_MODEL_36:
+               case B_CPU_AMD_TURION_64_MODEL_76:
+               case B_CPU_AMD_TURION_64_MODEL_104:
+                       return "Turion 64";
+               case B_CPU_AMD_PHENOM_MODEL_2:
                        return "Phenom";
-               case B_CPU_AMD_PHENOM_II:
+               case B_CPU_AMD_PHENOM_II_MODEL_4:
+               case B_CPU_AMD_PHENOM_II_MODEL_5:
+               case B_CPU_AMD_PHENOM_II_MODEL_6:
+               case B_CPU_AMD_PHENOM_II_MODEL_10:
+                       get_cpuid_model_string(cpuidName);
+                       if (strcasestr(cpuidName, "Athlon") != NULL)
+                               return "Athlon II";
                        return "Phenom II";
-               case B_CPU_AMD_GEODE_LX:
-                       return "Geode LX";
+               case B_CPU_AMD_A_SERIES:
+                       return "A-Series";
+               case B_CPU_AMD_C_SERIES:
+                       return "C-Series";
+               case B_CPU_AMD_E_SERIES:
+                       return "E-Series";
+               case B_CPU_AMD_FX_SERIES:
+                       return "FX-Series";
 
                /* Transmeta */
                case B_CPU_TRANSMETA_CRUSOE:
diff --git a/src/system/kernel/arch/x86/arch_system_info.cpp 
b/src/system/kernel/arch/x86/arch_system_info.cpp
index 5fe4d8c..3f2eb22 100644
--- a/src/system/kernel/arch/x86/arch_system_info.cpp
+++ b/src/system/kernel/arch/x86/arch_system_info.cpp
@@ -117,16 +117,16 @@ arch_system_info_init(struct kernel_args *args)
        }
 
        if (base != B_CPU_x86) {
-               if (base == B_CPU_INTEL_x86) {
+               if (base == B_CPU_INTEL_x86
+                       || (base == B_CPU_AMD_x86 && cpu->arch.family == 0xF)) {
                        model = (cpu->arch.extended_family << 20)
                                + (cpu->arch.extended_model << 16)
                                + (cpu->arch.family << 4) + cpu->arch.model;
                } else {
-                       model = (cpu->arch.family << 4) +
-                       cpu->arch.model;
-                       // There isn't much useful information yet in the 
extended
-                       // family and extended model fields of AMD processors
-                       // and is probably undefined for others
+                       model = (cpu->arch.family << 4)
+                               + cpu->arch.model;
+                       // Isn't much useful extended family and model 
information
+                       // yet on other processors.
                }
        }
 

############################################################################

Revision:    hrev44225
Commit:      966df2f98b509218c8743d9b468bb0929e6aa00f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=966df2f
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Mon Jun  4 16:05:36 2012 UTC

cpuidtool: Style cleanup

----------------------------------------------------------------------------

diff --git a/src/tools/cpuidtool.c b/src/tools/cpuidtool.c
index b7837e8..570fd79 100644
--- a/src/tools/cpuidtool.c
+++ b/src/tools/cpuidtool.c
@@ -7,12 +7,12 @@
  */
 
 /*
- * Pass an Intel CPUID in hex, and get out a CPUID for OS.h
+ * Pass a standard CPUID in hex, and get out a CPUID for OS.h
  */
 
 
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 
@@ -24,29 +24,33 @@
 
 
 // Converts a hexadecimal string to integer
-static int xtoi(const char* xs, unsigned int* result)
+static int
+xtoi(const char* xs, unsigned int* result)
 {
        size_t szlen = strlen(xs);
-       int i, xv, fact;
+       int i;
+       int xv;
+       int fact;
 
        if (szlen > 0) {
                // Converting more than 32bit hexadecimal value?
-               if (szlen>8) return 2; // exit
+               if (szlen > 8)
+                       return 2;
 
                // Begin conversion here
                *result = 0;
                fact = 1;
 
                // Run until no more character to convert
-               for (i = szlen - 1; i>=0 ;i--) {
-                       if (isxdigit(*(xs+i))) {
-                               if (*(xs+i)>=97) {
-                                       xv = ( *(xs+i) - 97) + 10;
-                               } else if ( *(xs+i) >= 65) {
-                                       xv = (*(xs+i) - 65) + 10;
-                               } else {
-                                       xv = *(xs+i) - 48;
-                               }
+               for (i = szlen - 1; i>=0; i--) {
+                       if (isxdigit(*(xs + i))) {
+                               if (*(xs + i) >= 97)
+                                       xv = (*(xs + i) - 97) + 10;
+                               else if (*(xs + i) >= 65)
+                                       xv = (*(xs + i) - 65) + 10;
+                               else
+                                       xv = *(xs + i) - 48;
+
                                *result += (xv * fact);
                                fact *= 16;
                        } else {


Other related posts:

  • » [haiku-commits] haiku: hrev44225 - src/tools headers/os/kernel headers/private/shared src/system/kernel/arch/x86 - kallisti5