shithub: pdffs

Download patch

ref: 7c3dae6ee98d99ea92bc06a830acf59f40108d45
parent: f33615cbd2103b8fbbc04cd3e3558b932f8398ce
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Nov 22 14:43:17 EST 2020

ascii85 filter: call bufput once per 4 bytes

--- a/f_ascii85.c
+++ b/f_ascii85.c
@@ -5,8 +5,8 @@
 static int
 flreadall(void *aux, Buffer *bi, Buffer *bo)
 {
+	uchar *in, c[4];
 	int i, j, insz;
-	uchar *in;
 	u32int x;
 
 	USED(aux);
@@ -20,10 +20,11 @@
 	for(i = 0; i < insz; i += 5){
 		for(x = 0, j = 0; j < 5; j++)
 			x = x*85 + ((i+j < insz ? in[i+j] : 'u') - 33);
-		bufput(bo, (uchar*)&x+3, 1);
-		bufput(bo, (uchar*)&x+2, 1);
-		bufput(bo, (uchar*)&x+1, 1);
-		bufput(bo, (uchar*)&x+0, 1);
+		c[0] = x >> 24;
+		c[1] = x >> 16;
+		c[2] = x >> 8;
+		c[3] = x;
+		bufput(bo, c, 4);
 	}
 	bi->off = bi->sz;