Questions tagged [uint]

is a type of variable and is used to store the equivalent of a mathematical non-negative integer

Due to the limited amount of memory a computer can handle, uint can represent just a subset of positive integers.

In C the uint standard is unsigned int and uses 4 bytes of memory (and thus can represents all integers int the range 0 to 4,294,967,295)

192 questions
1
vote
2 answers

What's the differences between a UINT and a WORD with Profinet

I'm developing a project on a Siemens PLC and i'm wondering if I should use a Word or a UINT to store a 16-bit value. Is there any differences between the two?
jfpatenaude
  • 86
  • 1
  • 8
1
vote
1 answer

Swift - UInt behaviour

Using my 64 bit Mac (Macbook Pro 2009), this code in Xcode playground is acting weird: let var1 = UInt32.max // 4,294,967,295 let var2 = UInt64.max // -1 --> why? var var3: UInt = UInt.max // -1 --> why? var3 = -1 // generates an error. setting…
Milad
  • 1,239
  • 3
  • 19
  • 37
1
vote
1 answer

Java to C# conversion - int uint types

I'm converting code from java to c# and got stuck with int and uint. Java code (excerpt): public static final int SCALE_PROTO4_TBL = 15; public static final int [] sbc_proto_4 = { 0xec1f5e60 >> SCALE_PROTO4_TBL }; Converted c# code…
user1005448
  • 617
  • 3
  • 12
  • 22
1
vote
2 answers

Cannot convert string to uint in c#

i am pretty new to c# and for some reason my number wont convert for the life of me. My code is: foreach(var descriptionid in test.items) { ulong description = Convert.ToUInt32(descriptionid.Value.descriptionid); …
ETurns
  • 73
  • 1
  • 12
1
vote
1 answer

What is the return value of int plus uint?

I have two variables: int a; uint b; I also have an array: float c[100]; If I want to pass a+b as the index of array c such that: c[a+b] = 10.0; For safety purpose, we should make sure a+b returns uint. Does it return unit? Should I force its…
HeyMan
  • 163
  • 2
  • 11
1
vote
3 answers

C++ - Which are variable by " Uint "?

Which are variable by " Uint "? is that there are " Uint8 ", " Uint16 ", etc ... But what are they ? Now I have some time using C ++ but I have never needed to use these variables and cause me curious. Thanks in advance.
xXlMisticXx
  • 13
  • 1
  • 3
1
vote
1 answer

How to convert the byte data of Int32 to UInt32 and back?

Academically Natured Question: How can the byte data of an Int32 with the value of -1 be cast into an UInt32? (can SWIFT do that?) Understanding: I know that -1 isn't a value that can be represented by an Unsigned Integer, as UInts only contain…
Jono Tho'ra
  • 1,476
  • 3
  • 18
  • 28
1
vote
2 answers

PHP - unpack() uint8_t and uint16_t

This is my first question here - so I apologize in advance for any errors. I currently work on a project, which includes a C++ program, communicating with a web server running PHP. I've used PHP's unpack/pack many times, but always with whole…
navotjer
  • 13
  • 4
1
vote
2 answers

IntPtr to Int - C#

I have this code : public uint StringsSize { get; set; } byte[] buffer = new byte[(IntPtr) XSC.header.StringsSize]; returning the following error : "Cannot explicitly convert type 'intptr' to 'int'. An explicit conversion exists (are you…
WowSki Bowse
  • 25
  • 1
  • 4
1
vote
3 answers

Convert from string to UInt32 - C#

I read UInt32 value as a string from XML file. And then I want to convert it to UInt32. UInt32 res = Convert.ToUInt32("0x00B73004", 16); But after converting the resulting value is: 12005380 Why it is so?
Advice Me
  • 79
  • 5
  • 13
1
vote
3 answers

Python bitstring uint seen as long

I have the following: I read 30 bits from a bitstream: MMSI = b.readlist('uint:30') This seems to work normally except when the values get higher. MMSI = b.readlist('uint:30') p = 972128254 # repr(MMSI)[:-1] print p print "MMSI :" print MMSI if…
1
vote
0 answers

uintptr_t not converting the value back to pointer

I'm using Cython to wrap a C++ library, where I use (uintptr_t)(void *) cast to pass pointers to python callers and getback as a handle. In one such scenario - I pass a casted pointer as a Python Integer to another Cython function. In the original…
1
vote
1 answer

Swift Cast as Generic crashing with UInt

Why does the following Array extension crash if the array used with it is of type UInt, but works if the array is of type Int or String? extension Array { func indexOf(value:T) -> Int? { for (i, val) in enumerate(self) { …
BadmintonCat
  • 9,416
  • 14
  • 78
  • 129
1
vote
1 answer

uint was not declared in this scope

I'm trying to setup a Google test in Qt and I am having multiple problems, the most annoying of which is "uint was not declared in this scope". This was compiling until recently but now it has decided it cannot find it.
Alan
  • 302
  • 5
  • 22
1
vote
1 answer

Converting UINT32 color format from AaBbGgRr to AaRrGgBb

I am trying to convert an UINT32 color format from AaBbGgRr to AaRrGgBb in c++. Aa = Alpha, Bb = Blue, Gg = Green Rr = Red. By converting I mean switching the values of Bb and Rr. Does somebody know how I can achieve that ?
Tobbi
  • 15
  • 5