conversion for 64bit

unsigned chars, longs to ints, the usual
constness, rationalise use of tempbuf