On Sat, 9 Dec 1995, Paul Cole wrote: > Now for the method that does work but is highly proprietary. > But close inspection would show that you can use a mere 2 bits for these 4 > values becuase RUNNING is only possible when you are WALKING and DIVING is > only possible when you are SWIMMING. Also, I note that WALKING is the same > thing as NOT FLYING. So you could <though I don't, too much work> use 2 > bits to represent this. > > XY where > X -- 1 = SWIMMING, 0 = WALKING > Y -- 1 = DIVING, 0 = RUNNING > or 00 = NOT SWIMMING and NOT RUNNNING = WALKING > 01 = NOT SWIMMING and RUNNING > 10 = SWIMMING and NOT DIVING > 11 = SWIMMING and DIVING > > Thus I've just implemented all 4 STATES in 2 BITS. > > This is very proprietary and imho, not terribly useful. It is only > presented here as a method for representing more than X FLAGS in an Xbit > bit field. That is not proprietary. I was using logic like that back in 1981. To lay a claim of 'proprietary' on that is ludicrous in the extreme. I was not the only one doing that type of logic either, as I recall seeing it in an old accounting system written to run on the TRS-80 model I. Your comments on bitfields, etc, is however, highly correct. Perhaps you could add that when viewing a situation where any combination is possible, it is in reality a permutation. Ian.
This archive was generated by hypermail 2b30 : 12/07/00 PST