summaryrefslogtreecommitdiffstats
path: root/vendor/modernc.org/libc/printf.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/modernc.org/libc/printf.go')
-rw-r--r--vendor/modernc.org/libc/printf.go31
1 files changed, 26 insertions, 5 deletions
diff --git a/vendor/modernc.org/libc/printf.go b/vendor/modernc.org/libc/printf.go
index b8200add..a26ad40e 100644
--- a/vendor/modernc.org/libc/printf.go
+++ b/vendor/modernc.org/libc/printf.go
@@ -7,6 +7,7 @@ package libc // import "modernc.org/libc"
import (
"bytes"
"fmt"
+ "runtime"
"strconv"
"strings"
"unsafe"
@@ -136,14 +137,17 @@ more:
// the output is empty.
format++
var arg int64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
- case modNone, modL, modLL, mod64:
+ case modL, modLL, mod64:
arg = VaInt64(args)
case modH:
arg = int64(int16(VaInt32(args)))
case modHH:
arg = int64(int8(VaInt32(args)))
- case mod32:
+ case mod32, modNone:
arg = int64(VaInt32(args))
default:
panic(todo("", mod))
@@ -167,6 +171,9 @@ more:
// precision 0, the output is empty.
format++
var arg uint64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
case modNone:
arg = uint64(VaUint32(args))
@@ -200,6 +207,9 @@ more:
// precision 0, the output is empty.
format++
var arg uint64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
case modNone:
arg = uint64(VaUint32(args))
@@ -284,6 +294,9 @@ more:
// printed with an explicit precision 0, the output is empty.
format++
var arg uint64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
case modNone:
arg = uint64(VaUint32(args))
@@ -406,9 +419,17 @@ more:
// The void * pointer argument is printed in hexadecimal (as if by %#x or
// %#lx).
format++
- arg := VaUintptr(args)
- buf.WriteString("0x")
- buf.WriteString(strconv.FormatInt(int64(arg), 16))
+ switch runtime.GOOS {
+ case "windows":
+ switch runtime.GOARCH {
+ case "386", "arm":
+ fmt.Fprintf(buf, "%08X", VaUintptr(args))
+ default:
+ fmt.Fprintf(buf, "%016X", VaUintptr(args))
+ }
+ default:
+ fmt.Fprintf(buf, "%#0x", VaUintptr(args))
+ }
case 'c':
// If no l modifier is present, the int argument is converted to an unsigned
// char, and the resulting character is written. If an l modifier is present,