12 #ifndef hifi_ByteRange_h
13 #define hifi_ByteRange_h
16 int64_t fromInclusive { 0 };
17 int64_t toExclusive { 0 };
19 bool isSet()
const {
return fromInclusive < 0 || fromInclusive < toExclusive; }
20 int64_t size()
const {
return toExclusive - fromInclusive; }
27 return toExclusive >= 0
28 && (toExclusive >= fromInclusive || toExclusive == 0)
29 && (fromInclusive >= 0 || toExclusive == 0);
32 void fixupRange(int64_t fileSize) {
36 toExclusive = fileSize;
39 if (fromInclusive > 0 && toExclusive == 0) {
42 toExclusive = fileSize;
43 }
else if (-fromInclusive >= fileSize) {
47 toExclusive = fileSize;