diff options
Diffstat (limited to 'xdelta3/xdelta3.h')
-rw-r--r-- | xdelta3/xdelta3.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h index ac5720f..c2741dd 100644 --- a/xdelta3/xdelta3.h +++ b/xdelta3/xdelta3.h | |||
@@ -1289,7 +1289,7 @@ void xd3_set_flags (xd3_stream *stream, int flags) | |||
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | /* Gives some extra information about the latest library error, if any | 1291 | /* Gives some extra information about the latest library error, if any |
1292 | is known. */ | 1292 | * is known. */ |
1293 | static inline | 1293 | static inline |
1294 | const char* xd3_errstring (xd3_stream *stream) | 1294 | const char* xd3_errstring (xd3_stream *stream) |
1295 | { | 1295 | { |
@@ -1297,19 +1297,16 @@ const char* xd3_errstring (xd3_stream *stream) | |||
1297 | } | 1297 | } |
1298 | 1298 | ||
1299 | 1299 | ||
1300 | /* 64-bit divisions are expensive. on a 32bit platform, these show in | 1300 | /* 64-bit divisions are expensive, which is why we require a power-of-2 |
1301 | * a profile as __udivdi3(). these are all the xoff_t divisions: */ | 1301 | * block size. To relax this restriction is relatively easy, see the history |
1302 | * for this method. gcc users should not see __udivdi3() in xd3_ profiles. */ | ||
1302 | static inline | 1303 | static inline |
1303 | void xd3_blksize_div (const xoff_t offset, | 1304 | void xd3_blksize_div (const xoff_t offset, |
1304 | const xd3_source *source, | 1305 | const xd3_source *source, |
1305 | xoff_t *blkno, | 1306 | xoff_t *blkno, |
1306 | usize_t *blkoff) { | 1307 | usize_t *blkoff) { |
1307 | *blkno = source->maskby ? | 1308 | *blkno = (xoff_t) (offset >> source->shiftby); |
1308 | (offset >> source->shiftby) : | 1309 | *blkoff = (usize_t) (offset & source->maskby); |
1309 | (offset / source->blksize); | ||
1310 | *blkoff = source->maskby ? | ||
1311 | (offset & source->maskby) : | ||
1312 | (offset - *blkno * source->blksize); | ||
1313 | } | 1310 | } |
1314 | 1311 | ||
1315 | #endif /* _XDELTA3_H_ */ | 1312 | #endif /* _XDELTA3_H_ */ |