Re: Can I avoid "shift count is negative" warning? (involves template parameter)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



jlh wrote:
template <int a>
int shift (int b)
{
	if (a > 0) {
		unsigned ua = a;
		return b >> ua;
	} else {
		unsigned ua = -a;
		return b << ua;
	}
}
template int shift<1>(int);
template int shift<-1>(int);


Thanks, that works!

Phil.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux