% Index: vm_swap.c % =================================================================== % RCS file: /home/ncvs/src/sys/vm/vm_swap.c,v % retrieving revision 1.127 % retrieving revision 1.128 % diff -u -1 -r1.127 -r1.128 % --- vm_swap.c 3 Jan 2003 09:55:05 -0000 1.127 % +++ vm_swap.c 3 Jan 2003 14:30:46 -0000 1.128 % ... % @@ -353,3 +352,3 @@ % */ % - aligned_nblks = (nblks + (dmmax - 1)) & ~(u_long)(dmmax - 1); % + aligned_nblks = (nblks + dmmax_mask) & ~(u_long)dmmax_mask; % % @@ -472,3 +471,3 @@ % % - aligned_nblks = (nblks + (dmmax - 1)) & ~(u_long)(dmmax - 1); % + aligned_nblks = (nblks + dmmax_mask) & ~(u_long)dmmax_mask; % nswap = aligned_nblks * nswdev;
dmmax_mask is ~(dmmax - 1) not (dmmax - 1), so all of these changes are wrong. (New) nearby style bugs: removing the use of dmmax bogotifies a comment which refers to dmmax. (Old) related type bugs: dmmax_mask has the bogus type `int', so it is not clear how it works as a mask on machines with 32-bit ints and 64-bit block numbers. I think it works because all supported machines are 2's complement; this makes the negative value obtained by complementing the bits of (dmmax - 1) right for masking with ints, and C's integral promotion rules then make it right for masking with larger integral types too. ~(u_long)(dmmax - 1) in the old code was more careful about this, except it only works for u_long and smaller block numbers (which is enough for aligned_nblks). Bruce To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
