Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vndcompress Simplify vndcompress offtab_compute_wind...
details: https://anonhg.NetBSD.org/src/rev/690f87f1ed04
branches: trunk
changeset: 326210:690f87f1ed04
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jan 22 06:17:16 2014 +0000
description:
Simplify vndcompress offtab_compute_window_size.
diffstat:
usr.bin/vndcompress/offtab.c | 17 ++++++-----------
1 files changed, 6 insertions(+), 11 deletions(-)
diffs (46 lines):
diff -r 5f0e4aea0d6f -r 690f87f1ed04 usr.bin/vndcompress/offtab.c
--- a/usr.bin/vndcompress/offtab.c Wed Jan 22 06:17:07 2014 +0000
+++ b/usr.bin/vndcompress/offtab.c Wed Jan 22 06:17:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: offtab.c,v 1.7 2014/01/22 06:17:07 riastradh Exp $ */
+/* $NetBSD: offtab.c,v 1.8 2014/01/22 06:17:16 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -64,23 +64,18 @@
}
static uint32_t
-offtab_compute_window_size(struct offtab *offtab, uint32_t start,
- uint32_t end)
+offtab_compute_window_size(struct offtab *offtab, uint32_t start)
{
- if (end == 0)
- end = offtab->ot_n_offsets;
-
- assert(end <= offtab->ot_n_offsets);
- assert(start < end);
- return MIN(offtab->ot_window_size, (end - start));
+ assert(start < offtab->ot_n_offsets);
+ return MIN(offtab->ot_window_size, (offtab->ot_n_offsets - start));
}
static uint32_t
offtab_current_window_size(struct offtab *offtab)
{
- return offtab_compute_window_size(offtab, offtab->ot_window_start, 0);
+ return offtab_compute_window_size(offtab, offtab->ot_window_start);
}
static uint32_t
@@ -104,7 +99,7 @@
const uint32_t window_start = rounddown(blkno, offtab->ot_window_size);
const uint32_t window_size = offtab_compute_window_size(offtab,
- window_start, 0);
+ window_start);
__CTASSERT(MAX_WINDOW_SIZE <= (SIZE_MAX / sizeof(uint64_t)));
__CTASSERT(MAX_N_OFFSETS <= (OFF_MAX / sizeof(uint64_t)));
Home |
Main Index |
Thread Index |
Old Index