[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

>Assembly How does the AND (&) operation work on 16 bit

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 9
Thread images: 1

File: VbMXcJSmsUA.jpg (16KB, 200x200px) Image search: [Google]
VbMXcJSmsUA.jpg
16KB, 200x200px
>Assembly
How does the AND (&) operation work on 16 bit numbers? Is it equivalents to add if its not a logical operarator (&&)
>>
Hi Ugly God
>>
>>58972614
AND basically sets the bits common to both numbers and clears the rest.

eg
10110010
01011010
--------- AND
00010010


Some common uses, taking the lower 4 bits from a number:
10110110
00001111
--------- AND
00000110


Make a number even (rounding towards 0):
10110101
11111110
--------- AND
10110100
>>
>>58972614
>What's Google?
It's a bit operator. Bitwise and.
11110000 & 10101010 = 10100000.
The numbers being 16bit doesn't change anything.
>>
It ANDs each bit:
1001 & 1100 == 1000
Basic math that you could have googled.
>>
>>58972614
ANDing with 0 is used to clear bits

ORing with 1 is used to set bits

XORing with 1 is used to flip bits
>>
>>58972788
>>58972794
see I thought that but on a test review, he has:
>0x9057 & 0x2F2A
>Result = 0x0002
>>
>>58972840
1001000001010111    (0x9057)
0010111100101010 (0x2f2a)
----------------- AND
0000000000000010 (0x0002)

Only the second bit is common to both numbers, so the answer is 2
>>
>>58972887
I am sorry
thread is over
Thread posts: 9
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.