473,322 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Basic bits operation

Simple question, I think:

I have a known byte, "byte 1":

0000 0100

and a known portion of an unknown byte, "byte 2":

bbbb 0100

I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
What's the most efficient way?

Aug 11 '07 #1
28 1939
philbo30 wrote:
Simple question, I think:

I have a known byte, "byte 1":

0000 0100

and a known portion of an unknown byte, "byte 2":

bbbb 0100

I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
What's the most efficient way?
(a&0x0f) == (b&x0f)

--
Ian Collins.
Aug 11 '07 #2
Ian Collins wrote:
philbo30 wrote:
>Simple question, I think:

I have a known byte, "byte 1":

0000 0100

and a known portion of an unknown byte, "byte 2":

bbbb 0100

I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
What's the most efficient way?
(a&0x0f) == (b&x0f)
Oops, (a&0x0f) == (b&0x0f)

--
Ian Collins.
Aug 11 '07 #3
On Sat, 11 Aug 2007 16:01:00 -0700, philbo30 wrote:
Simple question, I think:

I have a known byte, "byte 1":

0000 0100

and a known portion of an unknown byte, "byte 2":

bbbb 0100

I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
What's the most efficient way?
Use byte2 & 15 (or equivalently byte2 % 16, in this case) to
isolate the lower four bits. Then compare the lower four bits of
byte2 with the lower four bits of byte1 (remember that == binds
more tightly than &, so make sure you have enough parentheses), or
directly with 8 if you know that byte1 is always 8.

--
Army1987 (Replace "NOSPAM" with "email")
No-one ever won a game by resigning. -- S. Tartakower

Aug 11 '07 #4
On Sun, 12 Aug 2007 11:13:04 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>Ian Collins wrote:
>philbo30 wrote:
>>Simple question, I think:

I have a known byte, "byte 1":

0000 0100

and a known portion of an unknown byte, "byte 2":

bbbb 0100

I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
What's the most efficient way?
(a&0x0f) == (b&x0f)
Oops, (a&0x0f) == (b&0x0f)
!((a ^ b) & 0xF)

Will also work. Efficiency is architecture dependent, so test for it.

--
Dan Henry
Aug 11 '07 #5
Op Sun, 12 Aug 2007 01:18:29 +0200 schreef Army1987:
On Sat, 11 Aug 2007 16:01:00 -0700, philbo30 wrote:
>Simple question, I think:

I have a known byte, "byte 1":

0000 0100

and a known portion of an unknown byte, "byte 2":

bbbb 0100

I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
What's the most efficient way?
Use byte2 & 15 (or equivalently byte2 % 16, in this case) to
isolate the lower four bits. Then compare the lower four bits of
byte2 with the lower four bits of byte1 (remember that == binds
more tightly than &, so make sure you have enough parentheses), or
directly with 8 if you know that byte1 is always 8.
The byte maybe a signed char. If it holds a negative value, the remainder
after % is negative too ;-) Better use & here.
--
Coos
Aug 11 '07 #6
philbo30 wrote:
>
I have a known byte, "byte 1": and a known portion of an unknown
byte, "byte 2":

I need to compare the lower 4 bits (0100) of each and determine
if "byte 1, lower 4" == "byte 2, lower 4".

What's the most efficient way?
if ((b1 ^ b2) & 0x0f) /* bit fields unequal */ ;
else /* bit fields equal */ ;

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
--
Posted via a free Usenet account from http://www.teranews.com

Aug 11 '07 #7
Dan Henry <us****@danlhenry.comwrote:
On Sun, 12 Aug 2007 11:13:04 +1200, Ian Collins <ia******@hotmail.com>
wrote:
philbo30 wrote:
I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
Oops, (a&0x0f) == (b&0x0f)

!((a ^ b) & 0xF)

Will also work. Efficiency is architecture dependent, so test for it.
I'd never use that code unless it were shown with absolute certainty to
be a bottleneck. It's highly unclear compared Ian's. _If_ you can show
that the program is unacceptably slow with Ian's version, and fast
enough with yours, then I'd still first look for a better algorithm; and
only if that cannot be found, I'd use your version, and add a big
comment explaining why I didn't use the obvious code.

Richard
Aug 13 '07 #8
Richard Bos wrote:
Dan Henry <us****@danlhenry.comwrote:
>Ian Collins <ia******@hotmail.comwrote:
>>philbo30 wrote:

I need to compare the lower 4 bits (0100) of each and determine
if "byte 1, lower 4" == "byte 2, lower 4".
>>Oops, (a&0x0f) == (b&0x0f)

!((a ^ b) & 0xF)

Will also work. Efficiency is architecture dependent, so test
for it.

I'd never use that code unless it were shown with absolute
certainty to be a bottleneck. It's highly unclear compared Ian's.
_If_ you can show that the program is unacceptably slow with
Ian's version, and fast enough with yours, then I'd still first
look for a better algorithm; and only if that cannot be found,
I'd use your version, and add a big comment explaining why I
didn't use the obvious code.
What's unclear? The xor isolates the different bits (if any), and
the mask constrains the consideration to the lower 4 bits. It
avoids the non-vanishing probability of the compiler masking both
operands separately. I believe the original post specified that
speed was important.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Aug 14 '07 #9
On Mon, 13 Aug 2007 06:41:33 GMT, rl*@hoekstra-uitgeverij.nl (Richard
Bos) wrote:
>Dan Henry <us****@danlhenry.comwrote:
>On Sun, 12 Aug 2007 11:13:04 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>philbo30 wrote:
I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
>Oops, (a&0x0f) == (b&0x0f)

!((a ^ b) & 0xF)

Will also work. Efficiency is architecture dependent, so test for it.

I'd never use that code unless it were shown with absolute certainty to
be a bottleneck.
The OP asked "What's the most efficient way?". This alternate way
might be more efficient on some architectures and should be tested to
see.
>It's highly unclear compared Ian's.
It might be unclear to yet-another-general-ledger application writers,
but to folks that work close to the hardware, it is an instantly
recognizable and commonly used expression that certainly does not
merit a "big comment". We use bitwise operators all the time.
>_If_ you can show
that the program is unacceptably slow with Ian's version, and fast
enough with yours, then I'd still first look for a better algorithm; and
only if that cannot be found, I'd use your version, and add a big
comment explaining why I didn't use the obvious code.
Right, you don't like it. I can tell. We travel in different
circles.

--
Dan Henry
Aug 14 '07 #10
On Mon, 13 Aug 2007 06:41:33 GMT, rl*@hoekstra-uitgeverij.nl (Richard
Bos) wrote:
>Dan Henry <us****@danlhenry.comwrote:
>On Sun, 12 Aug 2007 11:13:04 +1200, Ian Collins <ia******@hotmail.com>
wrote:
>philbo30 wrote:
I need to compare the lower 4 bits (0100) of each and determine if
"byte 1, lower 4" == "byte 2, lower 4".
>Oops, (a&0x0f) == (b&0x0f)

!((a ^ b) & 0xF)

Will also work. Efficiency is architecture dependent, so test for it.

I'd never use that code unless it were shown with absolute certainty to
be a bottleneck.
Me either and then I would. The OP asked for efficiency. I posted an
alternative expression to Ian's. I don't know the OP's architecture
or toolchain. If the OP is concerned about efficiency, let the OP
test it.
>It's highly unclear compared Ian's.
Yes, oh dear, highly obscure, yet it was clear enough for my feeble
brain to recognize as an alternative. Strength in clarity compared to
Ian's was not a consideration for me.
>_If_ you can show
that the program is unacceptably slow with Ian's version, and fast
enough with yours, then I'd still first look for a better algorithm; and
only if that cannot be found, I'd use your version, and add a big
comment explaining why I didn't use the obvious code.
I cannot do that for you and am not particularly motivated to do so. I
don't know the OP's architecture or toolchain. Was that tiny
expression obfuscated to the point of being incomprehensible at a
casual glance? I'd guess that you have run across the '&' operator
before, so was it the '^' (exclusive-or) operator that threw you?

I certainly have no investment in what I posted and simply supplied an
alternative expression. Is that not allowed here? I was kind of
C-like, after all.

--
Dan Henry
Aug 14 '07 #11
Dan Henry <us****@danlhenry.comwrote:
On Mon, 13 Aug 2007 06:41:33 GMT, rl*@hoekstra-uitgeverij.nl (Richard
Bos) wrote:
_If_ you can show
that the program is unacceptably slow with Ian's version, and fast
enough with yours, then I'd still first look for a better algorithm; and
only if that cannot be found, I'd use your version, and add a big
comment explaining why I didn't use the obvious code.

I cannot do that for you and am not particularly motivated to do so.
You can't do it for anyone but yourself.
I don't know the OP's architecture or toolchain. Was that tiny
expression obfuscated to the point of being incomprehensible at a
casual glance? I'd guess that you have run across the '&' operator
before, so was it the '^' (exclusive-or) operator that threw you?
Let's put it this way. Your line was immediately obvious at a moment's
thought. Ian's line was immediately obvious _without_ having to think
about it. Unless there is clear evidence that your version is more
efficient in a particular situation, I'd prefer not having to think
about individual lines of code, so I can focus my thought on what the
program actually does.

Richard
Aug 15 '07 #12
On Wed, 15 Aug 2007 12:57:04 GMT, rl*@hoekstra-uitgeverij.nl (Richard
Bos) wrote:
>Dan Henry <us****@danlhenry.comwrote:
>On Mon, 13 Aug 2007 06:41:33 GMT, rl*@hoekstra-uitgeverij.nl (Richard
Bos) wrote:
I don't know the OP's architecture or toolchain. Was that tiny
expression obfuscated to the point of being incomprehensible at a
casual glance? I'd guess that you have run across the '&' operator
before, so was it the '^' (exclusive-or) operator that threw you?

Let's put it this way. Your line was immediately obvious at a moment's
thought. Ian's line was immediately obvious _without_ having to think
about it.
Too bad for me that the patent period has expired without my having
taken advantage of this (by my 30-year observation) most common form
of I/O port change detection logic. I and those around me *instantly*
recognize the expression (i.e., *without* a moment's thought).

"I pray Thee Lord, from this point forward, I promise to try to be
more tolerant of those who, through no particular fault of their own,
might take pause 'to think about it' when seeing 'my line'. I pray
that you give me strength when seeing 'my line' promulgated
world-wide, but without my benefit. I will strive to keep my wits and
mental balance despite the intolerable anguish of realizing my lost
opportunity by not legitimately claiming it as 'my own'. You tested
Job, now test me. I pray that I remain worthy."

Amen

--
Dan Henry
Aug 17 '07 #13
Dan Henry <us****@danlhenry.comwrote:
Amen
*Plonk*

Richard
Aug 17 '07 #14
rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
Dan Henry <us****@danlhenry.comwrote:
>Amen

*Plonk*

Richard
All the guy did, with an explanation, was to explain why he gave the
alternate expression.
Aug 17 '07 #15
On Fri, 17 Aug 2007 10:38:52 +0200, Richard <rg****@gmail.comwrote:
>rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
>Dan Henry <us****@danlhenry.comwrote:
>>Amen

*Plonk*

All the guy did, with an explanation, was to explain why he gave the
alternate expression.
Alternate expressions seem to be allowed in c.l.c. It could have been
that obscure exclusive-or operator that derailed him. No wait -- I
see that mere moments apart CBFalconer and I both used the offensive
exclusive-or operator, yet CBF got away with it scot-free. Methinks
there is some mighty fishy selective tolerance going on here!

Seriously though, no worries. I think Mr. Bos is better off no longer
reading my posts. My day-to-day use of C for working directly with
hardware exposes me to the kinds of expressions and usage patterns
that he apparently finds to be uncommon. If he were to read my future
posts, we'd likely have similar silly exchanges again. His killfiling
me now will avoid that, so I'm content with the quick action he has
taken.

--
Dan Henry
Aug 21 '07 #16
Dan Henry said:
On Fri, 17 Aug 2007 10:38:52 +0200, Richard <rg****@gmail.comwrote:
>>rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
>>Dan Henry <us****@danlhenry.comwrote:

Amen

*Plonk*

All the guy did, with an explanation, was to explain why he gave the
alternate expression.

Alternate expressions seem to be allowed in c.l.c.
Indeed they are.
It could have been
that obscure exclusive-or operator that derailed him.
It will take more than an XOR to derail Richard Bos.
No wait -- I
see that mere moments apart CBFalconer and I both used the offensive
exclusive-or operator, yet CBF got away with it scot-free. Methinks
there is some mighty fishy selective tolerance going on here!
FWIW I had no problem reading your expression (although I must admit I
prefer foo == 0 to !foo). Nor did Richard Bos - you can be sure of
that. He rightly enjoys a great deal of respect in this newsgroup for
his C knowledge, and would have had no trouble working out what your
code means. He just didn't think it was as self-evident as the code
that preceded it in the thread. But Richard Bos doesn't have a monopoly
on what is considered good code. It is purely a style issue, and
opinions on style vary widely within this group.
Seriously though, no worries. I think Mr. Bos is better off no longer
reading my posts.
He plonked you not for your code but for your ill-considered "prayer"
response, which seemed to suggest that you were more interested in
mockery than in thought. I hope that that response was merely a
temporary aberration.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 21 '07 #17
Dan Henry wrote:
>
On Fri, 17 Aug 2007 10:38:52 +0200, Richard <rg****@gmail.comwrote:
rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
Dan Henry <us****@danlhenry.comwrote:

Amen

*Plonk*
All the guy did, with an explanation, was to explain why he gave the
alternate expression.

Alternate expressions seem to be allowed in c.l.c.
I liked your ^ expresssion good enough.
It had a thoughtful comment about speed to go with it.
I don't consider ^ to be much more cryptic than &.
The thread subject was "Basic bits operation";
I wouldn't expect that to mean "& and nothing else"

But like Mr. Heathfield said,
I think it was your witty sarcasm that got the plonk.

I've indulged in witty sarcasm a lot on this newsgroup,
but I know that it's not good to do.

--
pete
Aug 21 '07 #18
pete said:

<snip>
I've indulged in witty sarcasm a lot on this newsgroup,
Well, half-witty, anyway.

And having failed to resist writing this reply, I will now try very hard
to resist posting it.

--
Rats.
Aug 21 '07 #19
Richard Heathfield wrote:
>
pete said:

<snip>
I've indulged in witty sarcasm a lot on this newsgroup,

Well, half-witty, anyway.

And having failed to resist writing this reply,
I will now try very hard to resist posting it.
My posts that I *have* discarded before sending, oh boy, oh boy...

--
pete
Aug 21 '07 #20
On Tue, 21 Aug 2007 00:24:53 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:
>Dan Henry said:
>It could have been
that obscure exclusive-or operator that derailed him.

It will take more than an XOR to derail Richard Bos.
...

FWIW I had no problem reading your expression (although I must admit I
prefer foo == 0 to !foo). Nor did Richard Bos - you can be sure of
that. He rightly enjoys a great deal of respect in this newsgroup for
his C knowledge, and would have had no trouble working out what your
code means. He just didn't think it was as self-evident as the code
that preceded it in the thread.
For the sake of accuracy, the phrase he used was "It's highly
unclear..."

FWIW, I've been reading c.l.c for an embarrassingly long time, so I am
not ignorant regarding current participants' level of respect amongst
their peers. I am even aware that there were other knowledgeable
folks that have come and gone before Mr. Bos and some others of the
current crew came on the scene.

--
Dan Henry
Aug 21 '07 #21
On Mon, 20 Aug 2007 20:46:42 -0400, pete <pf*****@mindspring.com>
wrote:
>Dan Henry wrote:
>>
On Fri, 17 Aug 2007 10:38:52 +0200, Richard <rg****@gmail.comwrote:
>rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:

Dan Henry <us****@danlhenry.comwrote:

Amen

*Plonk*

All the guy did, with an explanation, was to explain why he gave the
alternate expression.

Alternate expressions seem to be allowed in c.l.c.

I liked your ^ expresssion good enough.
It had a thoughtful comment about speed to go with it.
That was the OP's criterion ("efficient" actually, not speed). I
presented something different and from the very start advised the OP
to test it. The OP never even defined what he considered efficient;
fewer instructions, faster execution, typing economy, etc.

Anyway, Mr. Bos comes back to me with this bit: "_If_ you can show
that the program is unacceptably slow with Ian's version, and fast
enough with yours, then I'd still first look for a better algorithm;
and only if that cannot be found, I'd use your version, and add a big
comment explaining why I didn't use the obvious code."

As if to say: "Ugh! What a highly unclear, utterly vile little
expression you've come up with Mr. Henry. Prove to me it might be
faster on the OP's unstated architecture and toolchain, then I'll be
motivated to do you one better and if I can't and am forced to
actually use your putrid expression, I'll have to add a big comment
explaining my duress."

To me, that seemed an extreme reaction to and awfully tame expression.
I am pleased that you weren't so put off by it.

--
Dan Henry
Aug 21 '07 #22
Dan Henry said:
On Tue, 21 Aug 2007 00:24:53 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:
>>[Richard Bos] just didn't think it was as self-evident as the code
that preceded it in the thread.

For the sake of accuracy, the phrase he used was "It's highly
unclear..."
For the sake of even more accuracy, the phrase he used was "It's highly
unclear compared [to] Ian's", which is a rather different claim.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 21 '07 #23
Richard Heathfield wrote:
Dan Henry said:
>On Tue, 21 Aug 2007 00:24:53 +0000, Richard Heathfield
<rj*@see.sig.invalidwrote:
>>[Richard Bos] just didn't think it was as self-evident as the code
that preceded it in the thread.
For the sake of accuracy, the phrase he used was "It's highly
unclear..."

For the sake of even more accuracy, the phrase he used was "It's highly
unclear compared [to] Ian's", which is a rather different claim.
Goodness me, this thread is still going!

What are you doing working nights?

--
Ian Collins.
Aug 21 '07 #24
Ian Collins said:
What are you doing working nights?
Can't sleep. :-)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 21 '07 #25
pete wrote:
Richard Heathfield wrote:

pete said:

<snip>
I've indulged in witty sarcasm a lot on this newsgroup,
Well, half-witty, anyway.

And having failed to resist writing this reply,
I will now try very hard to resist posting it.

My posts that I have discarded before sending, oh boy, oh boy...
Sometimes it's helpful, like the old thing about writing exactly how
you feel in a letter to someone, then tearing it up rather than send it.

Brian
Aug 21 '07 #26
"Default User" <de***********@yahoo.comwrites:
pete wrote:
>Richard Heathfield wrote:
pete said:
<snip>

I've indulged in witty sarcasm a lot on this newsgroup,

Well, half-witty, anyway.

And having failed to resist writing this reply,
I will now try very hard to resist posting it.

My posts that I have discarded before sending, oh boy, oh boy...

Sometimes it's helpful, like the old thing about writing exactly how
you feel in a letter to someone, then tearing it up rather than send it.
The trick is to avoid sending it. Accidentally hitting the "send"
button (control-c control-c in my newsreader) is a lot easier than
accidentally putting a letter in an envelope, sealing it, putting a
stamp on it, and dropping it in a mailbox.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 21 '07 #27
Keith Thompson wrote:
"Default User" <de***********@yahoo.comwrites:
>pete wrote:
>>Richard Heathfield wrote:
pete said:
<snip>

I've indulged in witty sarcasm a lot on this newsgroup,

Well, half-witty, anyway.

And having failed to resist writing this reply,
I will now try very hard to resist posting it.

My posts that I have discarded before sending, oh boy, oh boy...

Sometimes it's helpful, like the old thing about writing exactly
how you feel in a letter to someone, then tearing it up rather
than send it.

The trick is to avoid sending it. Accidentally hitting the "send"
button (control-c control-c in my newsreader) is a lot easier than
accidentally putting a letter in an envelope, sealing it, putting
a stamp on it, and dropping it in a mailbox.
I have a 'draft' directory, and the reader can dump anything in
there in place of sending (or destruction). Very handy for cooling
off. Their usual fate is destruction.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Aug 22 '07 #28
pete <pf*****@mindspring.comwrote:
Dan Henry wrote:

On Fri, 17 Aug 2007 10:38:52 +0200, Richard <rg****@gmail.comwrote:
>rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
>
>Dan Henry <us****@danlhenry.comwrote:
>>
>>Amen
>>
>*Plonk*
>
>All the guy did, with an explanation, was to explain why he gave the
>alternate expression.
Alternate expressions seem to be allowed in c.l.c.
But like Mr. Heathfield said,
I think it was your witty sarcasm that got the plonk.
It was not the sarcasm. It was the hypocrisy.

Richard
Aug 23 '07 #29

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Sean Berry | last post by:
Say I have a dictionary like the following {1:'one',2:'two',4:'three',8:'four',16:'five', etc...} and I am given some numbers, say 22, 25, and 9. I want to determine the keys, powers of 2,...
3
by: Julia Donawald | last post by:
Hi, I have the following problem, and till now sadly I couldnt find an algorithm which does the job well. My problem is as follows: Given for example the following bit-value ( saved as unsigned...
53
by: Zhiqiang Ye | last post by:
Hi, All I am reading FAQ of this group. I have a question about this: http://www.eskimo.com/~scs/C-faq/q7.31.html It says: " p = malloc(m * n); memset(p, 0, m * n); The zero fill is...
25
by: Jhon | last post by:
Hi every one, I got very basic question, here i go: Say i have 11001 11010 bits which are infact 10 bits. Now i want to address every bit so if it is zero i would add one and if it is one...
5
by: Oyvind Eriksen | last post by:
Hello. I need to read bits from bytes in a file. I have code that works but it's very slow. Can anybody help me? The code I have is: private bool GetBit(byte b, int pos) { return ((b &...
8
by: webfan | last post by:
1. How many types of copy constructor in C++? 2. Will compiler-generated copy constructor do bitwise or memberwise copying?
10
by: krunalb | last post by:
Hi, I am trying to shift unsigned long long value by 64 bits and this is what i get #include <stdio.h> int main() { unsigned short shiftby= 64;
1
by: philbo30 | last post by:
Should be an easy question; I'm new to bits operations... I've got the parallel "control" register byte, initially at: 0000 0000 that after receiving an electrical "signal", looks like this: ...
19
by: sarahh | last post by:
Hi, I need help in the following question . I have a cpu that knows to do the computations on 32 bits(unsigned integer( write a function that gets 2 64 bits numbers and return their sum. I start...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.