I would like to replicate following C code in GoLang
uint32_t xx = 0x1FA19141;
uint32_t n = 1759730200;
uint32_t temp1 = xx << (32 - n);
My implementation is as follows:
var n int = 1759730200
temp := int32(32 - n)
temp1 := int32(xx << temp)
However, GoLang does not seem to allow negative shift,
I am getting runtime error as panic: runtime error: negative shift amount
According to source file go/expressions.c, go doesn’t seem to allow this operation for some reason
if (mpz_sgn(val) < 0)
{
this->report_error(_("negative shift count"));
....
}
How can I force shift left by negative number? Can somebody please help me with this issue?