unsigned Questions

16

I'm converting an unsigned integer to binary using bitwise operators, and currently do integer & 1 to check if bit is 1 or 0 and output, then right shift by 1 to divide by 2. However the bits a...
Calore asked 4/2, 2012 at 21:42

6

In C, why is signed int faster than unsigned int? True, I know that this has been asked and answered multiple times on this website (links below). However, most people said that there is no differe...
Menopause asked 8/12, 2015 at 20:9

8

I am trying to write a decoder for a very simple type of encryption. Numbers from 0-255 are entered via Scanner, the bits are inverted, and then converted to a character and printed. For example,...
Performative asked 24/7, 2010 at 10:25

10

Solved

Is it possible to parse a negative number into an unsigned value with Java's BigInteger? So for instance, I'd to interpret -1 as FFFFFFFFFFFFFFFF.
Outweigh asked 4/6, 2012 at 19:16

7

Solved

Let's say I have this number i = -6884376. How do I refer to it as to an unsigned variable? Something like (unsigned long)i in C.
Gerdagerdeen asked 24/12, 2013 at 21:14

13

Consider unsigned integer representation. How many bits will be required to store a decimal number containing: i) 3 digits ii) 4 digits iii) 6 digits iv) n digits I know that the range of the un...
Compressibility asked 22/8, 2011 at 15:47

3

I work with an application which uses rather big numbers and I need to store data as an unsigned 64-bit integer. I prefer to just store it without worrying about bit manipulation or anything like t...
Buckskin asked 4/12, 2008 at 23:30

6

Solved

I need to print a ULONGLONG value (unsigned __int64). What format should i use in printf ? I found %llu in another question but they say it is for linux only. Thanks for your help.
Funchal asked 7/8, 2013 at 15:25

17

Solved

Why doesn't Java include support for unsigned integers? It seems to me to be an odd omission, given that they allow one to write code that is less likely to produce overflows on unexpectedly larg...
Lati asked 10/1, 2009 at 1:35

3

Solved

Two's complements is set to make it easier for computer to compute the substraction of two numbers. But how computer distinguish an integer is signed integer or unsigned integer? It's just 0 and 1 ...
Daredeviltry asked 5/6, 2012 at 7:23

7

Solved

I was curious to know what would happen if I assign a negative value to an unsigned variable. The code will look somewhat like this. unsigned int nVal = 0; nVal = -5; It didn't give me any comp...
Susie asked 26/4, 2010 at 6:42

11

Solved

This is a rather silly question but why is int commonly used instead of unsigned int when defining a for loop for an array in C or C++? for(int i;i<arraySize;i++){} for(unsigned int i;i<arra...
Kidder asked 20/9, 2011 at 16:57

9

If lv stores a long value, and the machine is 32 bits, the following code: iv = int(lv & 0xffffffff) results an iv of type long, instead of the machine's int. How can I get the (signed) i...
Specular asked 3/9, 2009 at 20:54

4

Solved

I'm trying to subtract two unsigned ints and compare the result to a signed int (or a literal). When using unsigned int types the behavior is as expected. When using uint16_t (from stdint.h) types ...
Aubreir asked 6/4, 2012 at 18:56

5

Solved

I know about int and long (32-bit and 64-bit numbers), but what are uint and ulong?
Kovar asked 16/9, 2010 at 6:36

6

I'm trying to understand why the following code doesn't issue a warning at the indicated place. //from limits.h #define UINT_MAX 0xffffffff /* maximum unsigned int value */ #define INT_MAX 2147483...
Olen asked 24/3, 2011 at 8:17

8

How do you determine the length of an unsigned char*?
Heaney asked 7/5, 2009 at 19:27

8

Solved

I myself am convinced that in a project I'm working on signed integers are the best choice in the majority of cases, even though the value contained within can never be negative. (Simpler reverse f...
Impostor asked 9/11, 2008 at 11:56

17

Am I correct to say the difference between a signed and unsigned integer is: Unsigned can hold a larger positive value and no negative value. Unsigned uses the leading bit as a part of the value, ...
Ipecac asked 29/10, 2008 at 18:28

6

Solved

I am reading Carnegie Mellon slides on computer systems for my quiz. In the slide page 49 : Counting Down with Unsigned Proper way to use unsigned as loop index unsigned i; for (i = cnt-2; i <...
Rashida asked 26/2, 2017 at 5:57

3

Solved

I'm looking at the numeric types in Go. I want to use uint64 literals. Is this possible in Go? Here's an example of how I'd like to use uint64 literals: for i := 2; i <= k; i += 1 { // I want ...
Oubre asked 19/12, 2015 at 22:41

6

Solved

I have come across code from someone who appears to believe there is a problem subtracting an unsigned integer from another integer of the same type when the result would be negative. So that code ...
Sycee asked 28/8, 2011 at 13:59

17

Solved

I am trying to convert a signed byte in unsigned. The problem is the data I am receiving is unsigned and Java does not support unsigned byte, so when it reads the data it treats it as signed. I tr...
Doublecheck asked 24/11, 2010 at 12:29

3

Solved

I'm building a Unity iOS app for a client in the form of an unsigned XCArchive as the client signs the XCArchive manually for security reasons. I was following this guide beforehand: How to build ...
Arcature asked 2/10, 2018 at 4:23

3

Solved

I just wrote and ran following program. This just gave an unexpected output without + sign printed to U...MAX. #include <limists.h> #include <stdio.h> #include <stdlib.h> int main...
Dormouse asked 24/9, 2021 at 11:23

© 2022 - 2024 — McMap. All rights reserved.