FT-271 Fix mixed signed/unsigned comparison which breaks some versions
of gcc