bit-manipulation
Increase a double to the next closest value?
This isn\'t a question for a real-life project; I\'m only curious. We can increase an int using the increment operator (i++). You can define this operation as:[详细]
2023-04-02 17:24 分类:问答Bitshift to multiply by any number
Using only adding, subtracting, and bitshifting, how can I multiply an integer by a given number? For example, I want to multiply an integer by 17.[详细]
2023-04-02 16:23 分类:问答I am not getting the answer I expect using the Bitwise NOT operator. Would appreciate some help
I am working though a C++ book trying to learn some things.I am stuck on one thing, the bitwise not.I understand it flips all the bits but it is not working how I expect in C++.Here is the relevent co[详细]
2023-04-02 15:14 分类:问答Get byte - how is this wrong?
I want to get the designated byte from a 32 bit integer. I am getting wrong values but I don\'t know why.[详细]
2023-04-02 14:56 分类:问答Bit setting question
In C or C++, it\'s apparently possible to restrict the number of bits a variable has, so for example:[详细]
2023-04-02 07:53 分类:问答Checking if all bits in k between 1 to n are set
I was reading one question on the blog and the solution of t开发者_如何学JAVAhe question was to check whether 1 to n bits in \'k\' are set or not.[详细]
2023-04-02 03:26 分类:问答Integer |= Char; operation ignoring high order byte in Integer
Just a quick and specific question, this has stumped me for half an hour almost. char * bytes = {0x01, 0xD8};[详细]
2023-04-02 03:14 分类:问答bit-wise operation unary ~ (invert)
I\'m a little confused by the ~ operator. Code goes below: a = 1 ~a#-2 b = 15 ~b开发者_如何学运维#-16[详细]
2023-04-02 02:38 分类:问答C converting an int to a bitshift operator
I can only use these symbols: ! ~ & ^ | + << >> Here is the table I need to achieve: input | output开发者_JS百科[详细]
2023-04-01 10:52 分类:问答Right shift two's complement number like an unsigned int
Is this possible? I have a signed int and need to shift it right 4 places. I cannot cast the int to an unsigned int, shift and then cast back. I need to deal with it after.[详细]
2023-04-01 09:21 分类:问答