Home All Groups Group Topic Archive Search About

Difficult binary question

Author
8 Jul 2005 7:52 AM
Fabri
I have 2 bin values for bitmasking

0x800000000000000000000000000000 (it means that first bit is on)

and

0xA00000000000000000000000000000 (it means that first and third bit are on)

How can I know, via function or whatever, if in the second bin value is
there a bit on like in the first one?

I know there is system function varbintohexstr but I don't know to do this.

Any help much appreciated.

Regards.

--
Fabri
-Mandrake  "A Poma', c'hai 'na faccia...!"
-Pomata    "Sì, se ce n'avevo due già stavo all'università... sotto
spirito!"

Author
8 Jul 2005 12:09 PM
John Bell
Hi

Look at the topic "& (Bitwise AND)" in books online.

e.g.

declare @value int
declare @mask int
set @value = 0xAA
set @mask = 0xA

select @value as Value, @mask As Mask,@value & @mask as Result

John

Show quote
"Fabri" wrote:

> I have 2 bin values for bitmasking
>
> 0x800000000000000000000000000000 (it means that first bit is on)
>
> and
>
> 0xA00000000000000000000000000000 (it means that first and third bit are on)
>
> How can I know, via function or whatever, if in the second bin value is
> there a bit on like in the first one?
>
> I know there is system function varbintohexstr but I don't know to do this.
>
> Any help much appreciated.
>
> Regards.
>
> --
> Fabri
> -Mandrake  "A Poma', c'hai 'na faccia...!"
> -Pomata    "Sì, se ce n'avevo due già stavo all'università... sotto
> spirito!"
>

AddThis Social Bookmark Button