help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Masking using Hexadecimal Values


From: Mike Miller
Subject: Re: Masking using Hexadecimal Values
Date: Wed, 3 Aug 2016 14:37:05 -0700
User-agent: Mutt/1.6.2-neo (2016-07-23)

On Wed, Aug 03, 2016 at 13:16:16 -0400, Chip Wachob wrote:
> Hello,
> 
> I'm new to Octave, but I am trying to do some work where I need to mask off
> bits of a value.
> 
> I've tried using bitand() but that only seems to return a binary value.
> The function seems to return either a 1 or 0 but what I am looking for is a
> function / command that will return the bit-wise and of two numbers.
> 
> Eg:
> 
> bitand (0x55AA, 0xF0F0) is currently producing a 0
> 
> What command/function/code is required to have the statement yield 0x50A0?

  bitand (0x55AA, 0xF0F0)

returns a value of 0 for you? It works for me:

  >> bitand (0x55AA, 0xF0F0)
  ans =  20640
  >> sprintf ("0x%04X", bitand (0x55AA, 0xF0F0))
  ans = 0x50A0

-- 
mike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]