Nice way to convert `*int` to `*C.int`?

I got something that seems to work. I only have an x86_64 to test it on and the int will be truncated or something, but it compiles and runs.

calls.h

void cgocall(int* i) {
	*i = 42;
}

main.go

package main

// #include "calls.h"
import "C"

import (
	"log"
	"reflect"
)

func main() {
	log.SetFlags(log.Lshortfile)

	var input int = 12
	log.Println(C.sizeof_int, reflect.TypeOf(input).Size())

	log.Println(input)

	tmp := C.int(input)
	C.cgocall((*C.int)(&tmp))
	input = int(tmp)

	log.Println(input)
}

output

main.go:15: 4 8
main.go:17: 12
main.go:23: 42

Notice the sizes of the integers are different, but the conversion still worked. Please make sure it works as you expect on the systems you need to run on. I think the values will be truncated, but that could still be bad.