Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/vndcompress Emphasize that MAX_WINDOW_SIZE is bounde...
details: https://anonhg.NetBSD.org/src/rev/d1509a5a608f
branches: trunk
changeset: 352994:d1509a5a608f
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Apr 16 23:43:57 2017 +0000
description:
Emphasize that MAX_WINDOW_SIZE is bounded by the maximum uint32_t.
Since we store window sizes in uint32_t, the maximum had better fit
in uint32_t!
diffstat:
usr.bin/vndcompress/common.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (26 lines):
diff -r ebf948fc0839 -r d1509a5a608f usr.bin/vndcompress/common.h
--- a/usr.bin/vndcompress/common.h Sun Apr 16 22:38:04 2017 +0000
+++ b/usr.bin/vndcompress/common.h Sun Apr 16 23:43:57 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.6 2014/01/22 06:18:00 riastradh Exp $ */
+/* $NetBSD: common.h,v 1.7 2017/04/16 23:43:57 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -111,13 +111,13 @@
#define MAX_N_OFFSETS (MAX_N_BLOCKS + 1)
/*
- * The window size is at most the number of offsets, so it has the same
- * maximum bound. The default window size is chosen so that windows
+ * The window size is at most the number of offsets, or the largest
+ * uint32_t value. The default window size is chosen so that windows
* fit in one 4096-byte page of memory. We could use 64k bytes, or
* st_blksize, to maximize I/O transfer size, but the transfers won't
* be aligned without a lot of extra work.
*/
-#define MAX_WINDOW_SIZE MAX_N_OFFSETS
+#define MAX_WINDOW_SIZE MIN(UINT32_MAX, MAX_N_OFFSETS)
#define DEF_WINDOW_SIZE 512
struct cloop2_header {
Home |
Main Index |
Thread Index |
Old Index