From 460f0dff62c18b8443e0faafeac6abb8444655b6 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Thu, 4 Oct 2007 05:49:17 +0000 Subject: fix evil 64-bit bug: if we're using longs for bitsets 1 << shift will be undefined if shift > 31. Makes ccom work much better on 64-bit archs. --- usr.bin/pcc/mip/mkext.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/pcc/mip/mkext.c b/usr.bin/pcc/mip/mkext.c index 555e3ba7551..efc0329757b 100644 --- a/usr.bin/pcc/mip/mkext.c +++ b/usr.bin/pcc/mip/mkext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkext.c,v 1.4 2007/09/24 16:04:01 otto Exp $ */ +/* $OpenBSD: mkext.c,v 1.5 2007/10/04 05:49:16 otto Exp $ */ /* * Generate defines for the needed hardops. */ @@ -118,11 +118,14 @@ main(int argc, char *argv[]) } fprintf(fh, "#define NUMBITS %d\n", bitsz); fprintf(fh, "#define BITSET(arr, bit) " - "(arr[bit/NUMBITS] |= (1 << (bit & (NUMBITS-1))))\n"); + "(arr[bit/NUMBITS] |= ((%s)1 << (bit & (NUMBITS-1))))\n", + bitary); fprintf(fh, "#define BITCLEAR(arr, bit) " - "(arr[bit/NUMBITS] &= ~(1 << (bit & (NUMBITS-1))))\n"); + "(arr[bit/NUMBITS] &= ~((%s)1 << (bit & (NUMBITS-1))))\n", + bitary); fprintf(fh, "#define TESTBIT(arr, bit) " - "(arr[bit/NUMBITS] & (1 << (bit & (NUMBITS-1))))\n"); + "(arr[bit/NUMBITS] & ((%s)1 << (bit & (NUMBITS-1))))\n", + bitary); fprintf(fh, "typedef %s bittype;\n", bitary); /* register class definitions, used by graph-coloring */ -- cgit v1.2.3