about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY3
-rw-r--r--editor/pamditherbw.c10
2 files changed, 8 insertions, 5 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 6942d2aa..b66118da 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -8,6 +8,9 @@ not yet  BJH  Release 10.90.00
 
               pamundice: Add -listfile.
 
+              pamditherbw: Remove restriction to 2^18 pixels width and height
+              for -hilbert .
+
               pamundice: Add error and warning messages for insane file name
               pattern.
 
diff --git a/editor/pamditherbw.c b/editor/pamditherbw.c
index 6ec2511a..1943aa14 100644
--- a/editor/pamditherbw.c
+++ b/editor/pamditherbw.c
@@ -190,8 +190,6 @@ makeOutputPam(unsigned int const width,
 
 /* Hilbert curve tracer */
 
-#define MAXORD 18
-
 struct Hil {
     int order;
     int ord;
@@ -200,7 +198,10 @@ struct Hil {
     int dy;
     int x;
     int y;
-    int stage[MAXORD];
+    int stage[sizeof(unsigned int)*8];
+        /* One entry for every bit in the height or width, each of which
+           is an unsigned int
+        */
     int width;
     int height;
 };
@@ -217,8 +218,7 @@ initHilbert(int          const w,
     hilP->height = h;
     big = w > h ? w : h;
     for (ber = 2, hilP->order = 1; ber < big; ber <<= 1, hilP->order++);
-    if (hilP->order > MAXORD)
-        pm_error("Sorry, hilbert order is too large");
+    assert(hilP->order <= ARRAY_SIZE(hilP->stage));
     hilP->ord = hilP->order;
     hilP->order--;
 }