Hello,
I have seen a couple threads about what everyone was doing now a days in regards to signed vs unsigned key values. It would seem that unsigned is optimal since it allows twice the number of rows for the same cost. Are there any benefits with signed keys?
Is there any standard consensus? Its seems like signed is the answer since "...
I have an array of short whose values range between 0 and the maximum value of a short. I scale the data (to display it as TYPE_USHORT) so that the resulting short values range between 0 and 65535. I need to print some of the scaled values but can't figure out how. The data are in an array and in a BufferedImage.
...
I can never understand how to print unsigned long datatype in C.
Suppose boo is an unsigned long, then I try:
printf("%lu\n", unsigned_boo)
printf("%du\n", unsigned_boo)
printf("%ud\n", unsigned_boo)
printf("%ll\n", unsigned_boo)
printf("%ld\n", unsigned_boo)
printf("%dl\n", unsigned_boo)
And all of them print some kind of -12312312...
Background: I am receiving a array as char* as a part of socket session. Now we have to match the Tokens (HTTP headers) out of it.Code here is that we have created a UBYTE* and getting the value from the char array after typecasting with UBYTE. Later same UBYTE pointer we are passing to other function which accepts char* after typecastin...
I came from a mostly C/C++ background before I began using C#. One of the things I did with my first project in C# was make a class like this
class Element{
public uint Size;
public ulong BigThing;
}
I was then mortified by the fact that this requires casting:
int x=MyElement.Size;
as does
int x=5;
uint total=MyElement.Size+x;...
I'm new to VB.Net. I'm using a library call setInstance(ByVal instance As UInteger) in my VB.Net code. The parameter I need to pass is an Integer. Is there anything I need to do to convert the integer parameter to an unsigned integer? The number is garunteed to be positive and less than 10.
...
Hello,
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, the number 178 should convert to the letter "M".
178 is 10110010.
Inverting all of the bits should give 01001101, which is 77 or ...
In C is there a branch-less technique to compute the absolute difference between two unsigned ints? For example given the variables a and b, I would like the value 2 for cases when a=3, b=5 or b=3, a=5. Ideally I would also like to be able to vectorize the computation using the SSE registers.
...
I want to understand how to convert signed number into unsigned.
lets say I have this:
byte number = 127; // '1111111'
In order to make it unsigned I have to choose "bigger" data type 'short' and apply AND operator with value 0x00ff.
short number2;
number2 = number & 0x00ff;
Why does it make the number unsigned?
...
I'm attempting to use LAST_INSERT_ID on an auto incremented index that has moved past the signed int value 2147483647. This column is an unsigned int. However, LAST_INSERT_ID() is returning an invalid negative value. Researching this, I've found a couple comments indicating this is the nature of this function. But I cannot find it offici...
After reading this question on signed/unsigned compares (they come up every couple of days I'd say):
http://stackoverflow.com/questions/3475841/signed-unsigned-comparison-and-wall
I wondered why we don't have proper signed unsigned compares and instead this horrible mess? Take the output from this small program:
#include <stdio.h>...
I'm a fairly new programmer and I was wondering if someone could give me a practical explanation/example on the differences and uses between working with signed, unsigned and 32 bit vs 64 bit?
i.e. I read an article about how Twitter had developers switch to 64 bit last year but I wasn't sure the reasoning and the specific nature to it....
I have a loop that has to go from N to 0 (inclusively). My i variable is of type size_t which is usually unsigned. I am currently using the following code:
for (size_t i = N; i != (size_t) -1; --i) {
...
}
Is that correct? Is there a better way to handle the condition?
Thanks,
Vincent.
...
I want to use Preon for project that communicates with a server written in C. The protocol depends on the native endianess of the machine (you can solve with thisjava.nio.ByteOrder.getNative() under the assumption that the JVM has the same endianess as the server) and uses uint64_t for data lenghts and int32_t for status codes (a negativ...
Hi all,
i have gone through the numerous questions regarding signed/unsigned char. I understand there are three distinct char types in C++. Currently i have a large code-base which is compiled with Visual Studio - the "default char unsigned" setting is set to "No". Now i'm supposed to add a particular project to our code-base (integrate...
Hi i have a program that deals alot with vectors and indexes of the elements of these vectors , and I was wondering :
is there a difference between uint and unsigned int
which is better to use one of the above types or just use "int" as I read some people say compiler does handle int values more efficiently , but if i used int i will ...
hello All,
I was able to generate python bindings for a camera library using SWIG and I am able to capture and save image using the library's inbuilt functions.
I am trying to obtain data from the camera into Python Image Library format, the library provides functions to return camera data as unsigned char* .
Does anyone know how to c...
signed int x= -5;
unsigned int y=x;
what is the value of y? and how?
...
Is it important to declare a variable as unsigned if you know it should never be negative? Does it help prevent anything other than negative numbers being fed into a function that shouldn't have them?
...
I was helping someone with their homework and ran into this strange issue. The problem is to write a function that reverses the order of bytes of a signed integer(That's how the function was specified anyway), and this is the solution I came up with:
int reverse(int x)
{
int reversed = 0;
reversed = (x & (0xFF << 24)) >> 24;
...