shithub: scc

Download patch

ref: ca68760317b98797cdd7b0464390b04bb1fd8f23
parent: 628b7eaeb3daa2e2fa05171e399149bb3b804ad0
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Oct 1 05:16:54 EDT 2018

[cc1] Improve ones()

This function is inspired in the function getbits() of k&r.

--- a/cc1/fold.c
+++ b/cc1/fold.c
@@ -9,11 +9,7 @@
 TUINT
 ones(int nbytes)
 {
-	TUINT v;
-
-	for (v = 0; nbytes--; v |= 255)
-		v <<= 8;
-	return v;
+	return (nbytes == 8) ? -1 : ~(-1ull << nbytes * 8);
 }
 
 static int