From ccbd9b3bf61c17bc1f7e9226f7fe2ab690e62862 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 6 Mar 1995 21:45:34 +0000 Subject: [PATCH] Fix stupid bug in `copy_bits': code to generate mask was doing ((1 << 32) - 1) and expecting something reasonable to happen on a 32-bit machine. --- v7/src/microcode/bitstr.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/v7/src/microcode/bitstr.c b/v7/src/microcode/bitstr.c index 4e3a0c50e..251ac07cf 100644 --- a/v7/src/microcode/bitstr.c +++ b/v7/src/microcode/bitstr.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: bitstr.c,v 9.54 1995/01/25 20:54:55 cph Exp $ +$Id: bitstr.c,v 9.55 1995/03/06 21:45:34 cph Exp $ Copyright (c) 1987-95 Massachusetts Institute of Technology @@ -508,10 +508,13 @@ DEFUN (copy_bits, { long mask = (ANY_MASK (head, offset1)); dest_buffer - = (((BIT_STRING_WORD (destination)) - &~ (LOW_MASK (head + offset1))) - | (((* (DEC_BIT_STRING_PTR (source))) & (LOW_MASK (head))) - << offset1)); + = (((head + offset1) < OBJECT_LENGTH) + ? ((BIT_STRING_WORD (destination)) + &~ (LOW_MASK (head + offset1))) + : 0); + dest_buffer + |= (((* (DEC_BIT_STRING_PTR (source))) & (LOW_MASK (head))) + << offset1); } nbits -= head; while (nbits >= OBJECT_LENGTH) -- 2.25.1