On 04/22/2014 08:52 AM, Josh Stone wrote: > The trick in the original was that "(typeof (var)) __s.i" would extend > the sign from the 7th bit, which I don't your mask will do. Yes, that was another cut/paste error. Not a great batting average this morning... ;-) > So in total: > > struct { signed int i:7; } __s = { .i = __b }; > (var) |= (typeof (var)) __s.i * ((typeof (var)) 1 << ((nth) * 7)); > > Better? Yes, that's what I had in mind. r~