|
|
|
@ -127,15 +127,25 @@ func appendNumber(result *[]string, number string, useHex bool, groupSize int) {
|
|
|
|
|
maxValue = intMaxValue(useHex, maxDigits)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if the number exceeds the maximum value
|
|
|
|
|
if num > maxValue {
|
|
|
|
|
fmt.Fprintf(os.Stderr, "Warning: Number %d is too large for group size %d. Using maximum value %d.\n", num, groupSize, maxValue)
|
|
|
|
|
num = maxValue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Calculate the required length of the number based on the group size
|
|
|
|
|
requiredLength := groupSize
|
|
|
|
|
if useHex {
|
|
|
|
|
formatted = fmt.Sprintf("0x%X", num)
|
|
|
|
|
requiredLength -= 2 // For "0x" prefix
|
|
|
|
|
} else {
|
|
|
|
|
formatted = fmt.Sprintf("0d%d", num)
|
|
|
|
|
requiredLength -= 2 // For "0d" prefix
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Format the number with padding
|
|
|
|
|
if useHex {
|
|
|
|
|
formatted = fmt.Sprintf("0x%0*X", requiredLength, num)
|
|
|
|
|
} else {
|
|
|
|
|
formatted = fmt.Sprintf("0d%0*d", requiredLength, num)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*result = append(*result, formatted)
|
|
|
|
|