summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.h
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2009-11-03 01:50:13 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2009-11-03 01:50:13 +0000
commit7f7ac45b750fe90bc0572c1a53981910d24b878a (patch)
treefedb4169e6e2e4babf3e59bb82684e6d762f90ab /xdelta3/xdelta3.h
parent9c3c0e573dd63bd1a0345d38f46594293d58c9d2 (diff)
Fixes for issue 94.
Diffstat (limited to 'xdelta3/xdelta3.h')
-rw-r--r--xdelta3/xdelta3.h15
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. */
1293static inline 1293static inline
1294const char* xd3_errstring (xd3_stream *stream) 1294const 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. */
1302static inline 1303static inline
1303void xd3_blksize_div (const xoff_t offset, 1304void 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_ */