Questions tagged [uint32]

uint32 is a datatype that represents an unsigned integer and is coded on 32 bits in memory.

uint32 is a datatype that represents an and is coded on 32 bits in memory. Unlike its counterpart which is , uint32 can only be used to store positive integers, of values between 0 and 232 - 1.

176 questions
1
vote
1 answer

Convert [UInt32] -> [UInt8] -> [[UInt8]] in Swift

I am trying to speed up my current implementation of a function that converts [UInt32] to a [UInt8] which in turn is split up into [[UInt8]] with 6 arrays at each index. My implementation: extension Array { func splitBy(subSize: Int) -> [[Element]]…
p0ppy
  • 13
  • 3
1
vote
1 answer

Convert uint32 to string and add leading 0s

I need to convert uint32 to a string and add leading zeroes to a fixed length. How can I do that? Here's my code: var unixTs uint32 = 1446455472 var randomInt uint32 = 58964981 var expiredTs uint32 = 2 unixTsStr := fmt.Sprint("%010d",…
jameswfang
  • 109
  • 1
  • 8
1
vote
2 answers

convert uint8 and uint32 variables to one uint64

I have the following variables. uint8_t flags; uint32_t token; I need to write function that cobine them into one uint64_t, and than parse them back into two variables, one of uint8_t and one of uint32_t. uint64 convert(uint8_t flags, uint32_t…
Dan The Man
  • 1,835
  • 6
  • 30
  • 50
1
vote
1 answer

How to reverse bytes order in javascript Uint32

I need to send an ArrayBuffer via chrome.sockets.udp plugin. The data is sent via Android ionic app to an emulator that runs on a computer. I need to send the following fields: var arrayBuffer = new ArrayBuffer(20); var dv = new…
1
vote
3 answers

Easy SpriteKit Contact Detection (Space Shooter Game) Not Wotking Properly

I'm trying to make a simple Space Shooter game. The contact should happen either between the torpedo and the alien or the shuttle and the alien. The problem is that this second contact (shuttle vs. alien) only happens after the first kind of contact…
Jules
  • 571
  • 2
  • 5
  • 12
1
vote
2 answers

Bit manipulation on large integers out of 'int' range

Ok, so let's start with a 32 bit integer: int big = 536855551; // 00011111111111111100001111111111 Now, I want to set the last 10 bits to within this integer: int little = 69; // 0001101001 So, my approach was this: big = (big & 4294966272) &…
Corey Iles
  • 155
  • 1
  • 17
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

C for loop almost right

I am working on a homework problem involving comparing a recursive solution to a problem with its iterative counterpart. Currently I have the recursive function working for the given set of values, however the iterative version seems to work for…
tacoofdoomk
  • 53
  • 1
  • 7
1
vote
1 answer

Physics category struct in Sprite Kit

I have been making a game using Sprite Kit and its physics and met this struct in tutorial: struct PhysicsCategory { static let None: UInt32 = 0 static let All: UInt32 = UInt32.max static let Player: UInt32 = 0b10 static let…
Eduard
  • 516
  • 1
  • 4
  • 17
1
vote
1 answer

Getting byte[16] to uint32[4]

I'm trying to implement the XTEA algorithm in C#, and I've found a function to do that for me. However, there's a hurdle I have to pass. The function requires the data and the key be put into a UInt32 array. For the sake of time, I'll just post the…
Fuselight
  • 554
  • 6
  • 17
1
vote
0 answers

Convert String to UInt32 - Swift

I'm currently developing an app where i need the string value "0xE3413F" to be converted to a UInt32 with same value, "0xE3413F". The reason for this is that I'm using the value in a function that requires an UInt32 value. I have saved the string in…
ThomasGulli
  • 604
  • 1
  • 7
  • 20
1
vote
1 answer

Objective C UInt32 Definition

i found the following statement in code which I not completely understand: UInt32 *pixels; UInt32 *currentPixel = pixels; UInt32 color = *currentPixel; The first two lines are clear to me, as these are definitions of UInt32 objects, pixels, and…
sesc360
  • 3,155
  • 10
  • 44
  • 86
1
vote
2 answers

WPF Convert hex to UInt

I want to convert Hexadecimal into a UInt. The problem is the following: when I try this: uint value = Convert.ToUInt32((hex), 16); and the hex is for example 12 bytes size, all works fine, but when I try to convert a hex with 32 bytes size I have…
IrApp
  • 1,823
  • 5
  • 24
  • 42
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
2 answers

Entropy calculation in Matlab for uint32 type row vector

I need to calculate the entropy of a row vector.But the problem is my row vector is of uint32 type and Matlab gives an error that this type is not supported by the entropy() function. I tried converting the uint32 to uint16 but this increased the…
ksnf3000
  • 21
  • 3