1
0
mirror of https://github.com/golang/go synced 2024-11-26 18:26:48 -07:00
go/misc/cgo/test/issue20369.go
Hiroshi Ioka 7555a45dc2 cmd/cgo: support large unsigned macros
Currently, cgo converts integer macros into int64 if it's possible.
As a result, some macros which satisfy

math.MaxInt64 < x <= math.MaxUint64

will lose their original values.

This CL introduces the new probe to check signs,
so we can handle signed ints and unsigned ints separately.

Fixes #20369

Change-Id: I002ba452a82514b3a87440960473676f842cc9ee
Reviewed-on: https://go-review.googlesource.com/43476
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-05-17 14:42:29 +00:00

21 lines
424 B
Go

// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cgotest
/*
#define UINT64_MAX 18446744073709551615ULL
*/
import "C"
import (
"math"
"testing"
)
func test20369(t *testing.T) {
if C.UINT64_MAX != math.MaxUint64 {
t.Fatalf("got %v, want %v", uint64(C.UINT64_MAX), uint64(math.MaxUint64))
}
}