use of org.graalvm.word.SignedWord in project graal by oracle.
the class PosixJavaLangSubstitutions method readEntirely.
static SignedWord readEntirely(int fd, PointerBase buf, UnsignedWord count) {
Pointer ptr = WordFactory.pointer(buf.rawValue());
final Pointer end = ptr.add(count);
SignedWord read;
do {
Errno.set_errno(0);
read = Unistd.read(fd, ptr, end.subtract(ptr));
if (read.equal(0)) {
// EOF
break;
} else if (read.greaterThan(0)) {
ptr = ptr.add((int) read.rawValue());
}
} while (ptr.notEqual(end) && (read.notEqual(-1) || Errno.errno() == Errno.EINTR()));
if (ptr.notEqual(buf)) {
return WordFactory.signed(ptr.rawValue() - buf.rawValue());
}
return read;
}
Aggregations