Author: Andrew Shapira
Date: 20:31:56 09/21/05
Go up one level in this thread
Hi. I'm interested mainly in ideas - the details of these things can be worked out later. So being off by 1 somewhere does not really concern me right now. I have not heard anything about what I asked about - which is, how, in O(1) time, do you find the mask of the highest bit using only C's + - ^ ~ << >> operators? I thought this was clear in my original post, but maybe somehow it wasn't. Or maybe you didn't read it. The whole point is to do it quickly and portably. If I wanted to do it in an unportable way I would use machine instructions for finding the highest significant bit, or something similar. If I wanted to do it relatively slowly, say in O(lg N) time and not O(1) time, I would do it using the >>1, >>2, >>4 method. It is of some interest to do this using * or / although that is not the main question here. And I am definitely not interested at the moment in things that will only work on one machine.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.