working with binary numbers with bitwise operators

MisterX b.xavier at internet.lu
Mon May 31 10:06:39 EDT 2004

```I dont know if the value of the appended number
is important but appending of numbers requires a
base to base modulation or you get

put baseconvert(5431,10,2) = 1010100110111
put baseconvert(54,10,2)   = 110110
put baseconvert(31,10,2)   =         11111

110110 and 11111 do not make 1010100110111
To make this work...

consider instead that 5400 + 31 = 5431...

put baseconvert(5400,10,2) = 1010100011000
put baseconvert(31,10,2)   =         11111

put baseconvert( (5400 bitor 31),10,2)
= 1010100011111

a simpler example...
1600 + 16 = 1616
so
put baseconvert(1616,10,2) = 11001010000
put baseconvert(1600,10,2) = 11001000000
put baseconvert(  16,10,2) = 00000010000

if you bitor the 1600 and the 16 you should get... 1616

not tested for bug 38 ;)

> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of Alejandro
> Sent: Monday, May 31, 2004 06:48
> To: use-revolution at lists.runrev.com
> Subject: Re: working with binary numbers with bitwise operators
>
>
> on Sun, 30 May 2004
> Dar Scott wrote:
>
> > Bugzilla 38 describes a problem in base conversions
> > to base 10.
> > The baseconvert() function uses a 32 bit
> > environment.
> > The bit-logical operators use a 32-bit environment.
>
> Now i understand, thanks for this clarification.
>
> > If you need more than 32 bits you might need to
> > build up multiple 32-bit numbers
>
> Could be splitting a big number in two parts
> like this?
>
> 48 bit number
> 010011001100001110101010101101100101110111010101
>
> divided in two 24 bit numbers
>
> 010011001100001110101010
> 101101100101110111010101
>
> > or (as you did for shifting) use strings of 0 and 1.
> > If you need to use bit shifting (and rotating) with
> > the bit logical operators, you might want to make
> > the number conversion.
>
> I think that i'll use strings and custom funtions.
>
> Thanks for your help, Dar.
>
> al
>
> =====
> Visit my site:
> http://www.geocities.com/capellan2000/
> Search the mail list:
> http://mindlube.com/cgi-bin/search-use-rev.cgi
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
```