reader.cpp: safely handle signedness casts