Displaying 1 result from an estimated 1 matches for "byte_to_hex".
2006 Aug 22
0
[PATCH] [HVM] Make serial number in SMBIOS table equal to UUID
...+ b/tools/firmware/hvmloader/util.c Tue Aug 22 14:34:50 2006 -0400
@@ -174,3 +174,57 @@ cpuid(uint32_t idx, uint32_t *eax, uint3
: "0" (idx) );
}
+/* Write a two-character hex representation of ''byte'' to digits[].
+ Pre-condition: sizeof(digits) >= 2 */
+void
+byte_to_hex(char *digits, uint8_t byte)
+{
+ uint8_t nybbel = byte >> 4;
+
+ if (nybbel > 9)
+ digits[0] = ''a'' + nybbel-10;
+ else
+ digits[0] = ''0'' + nybbel;
+
+ nybbel = byte & 0x0f;
+ if (nybbel > 9)
+ digits[1] = ''a'' + nybbel-10;
+ el...