Can an example of bitwise subtraction be in code? I do not really understand what I mean.
|
1 answer
For example:
#include <stdio.h> int main() { unsigned char x = 0b00000100, y = 0b00000010; unsigned char res, carry = 0; unsigned char n; unsigned char xx, yy; for (n = 0; n < 8; ++n) { xx = x & 1 ? 0xFF: 0; yy = y & 1 ? 0xFF: 0; res = carry ? (~(xx^yy)) : xx^yy; carry = carry ? ((~xx)|yy) : ((~xx)&yy); printf( res ? "1" : "0" ); x >>= 1; y >>= 1; } printf("\r\n"); return 0; } - I'm afraid to even ask, is it ab? - pavel
- This is x - y ........ - Vanyamba Electronics
- just looks scary to say the least. I just do not believe that this is optimal ... - pavel
- oneThe C language is simply not very adapted for working with discharges. So you have to imitate Verilog. - Vanyamba Electronics
|
^- Mike