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
3
votes
2 answers

Converting Uint8Array to BigInt in Javascript

I have found 3 methods to convert Uint8Array to BigInt and all of them give different results for some reason. Could you please tell me which one is correct and which one should I use? Using bigint-conversion library. We can use…
Wor Chan
  • 139
  • 1
  • 11
3
votes
1 answer

Got an unnexpected error: "Attempted reassignment of binding to chisel3.core.UInt@29a" when declaring a Module's io

When declaring a new Module's io I got the following error: [error] (run-main-e) chisel3.core.Binding$RebindingException: Attempted reassignment of binding to chisel3.core.UInt@29a [error] chisel3.core.Binding$RebindingException: Attempted…
3
votes
1 answer

Input process and type for static uint8_t array

I am currently trying to convert an integer variable to the value of a static uint8_t array in the Arduino IDE. I am using: #include And I do understand that uint8_t acts similarly to the byte type. Currently, the array has a set…
3
votes
2 answers

How to convert HEX string to UInt16?

I have a HEX string d285 and I want to convert it UInt16, please guide me how I can convert it. I tried this let buffer = UInt16("\(UInt8(text, radix: 16)!)") return Data(bytes: (buffer?.bigEndian.toBytes)!) but it's not working
Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
3
votes
1 answer

How to display all values of uint32 array in variable browser?

I have a struct as shown below: I have a problem with this struct. In some fields, instead of the values as in the other fields, it's written 48x1 uint32. I want to have to numbers as in the other fields, for example [23;45;67]. My problem is that…
Ahinoa
  • 75
  • 7
3
votes
2 answers

How to force PHP to treat a number like a uint

I have some C# code that looks like this: uint a = 0x9E3779B9; a += (uint)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24)); After that code, a == 228 452 386 Now I'm trying to translate this C# code to PHP, but in PHP the…
Pete Michaud
  • 1,813
  • 4
  • 22
  • 36
3
votes
2 answers

Swift: Why does UInt.max == -1

As the title states, lldb reports the value of UInt.max to be a UInt of -1, which seems highly illogical. Considering that let uint: UInt = -1 doesn't even compile, how is this even possible? I don't see any way to have a negative value of UInt at…
Patrick Goley
  • 5,397
  • 22
  • 42
3
votes
1 answer

How to convert value of type UIColor to Uint in swift

I got this UIColor : UIColor(red: 0.2, green: 0.4118, blue: 0.1176, alpha: 1.0) And I need to convert in Uint. How can I do that? EDIT : func showEmailMessage(advice : String) { _ = SCLAlertView().showSuccess("Congratulation", subTitle:…
Marco Castano
  • 150
  • 3
  • 12
3
votes
0 answers

Creating a UInt8 Fails in App but Procceeds in Playground

I have converted an Objective-C script to Swift for forming header of an AAC frame. However the code fails to run in the app and crashes with an EXC_BAD_ACCESS. Copying the code in to playground outputs what I expect with no errors. Not sure where…
keji
  • 5,947
  • 3
  • 31
  • 47
3
votes
1 answer

Swift dictionary put [UInt8] as a value does not work

I create a dictionary in Swift: var type:String var content:[UInt8] let dict = NSMutableDictionary() dict.setValue(type, forKey: "type") dict.setValue(content, forKey: "content") I get an error: Cannot convert value of type [UInt8] to expected…
fcbflying
  • 693
  • 1
  • 7
  • 23
3
votes
2 answers

{(Int)} is not identical to UInt8

Currently using beta 5 version of swift and There must have been a change to the += operator func dealCards1() -> [Int] { for i in 0...25{ comp1PlayDeck += shuffledDeck[i] } return comp1PlayDeck } this throws the '[(Int)]' is…
arcreigh
  • 1,423
  • 2
  • 11
  • 12
3
votes
1 answer

Converting uint color to argb hexadecimal for kml color

Good day everyone, I am stuck trying to convert a uint color value into its equivalent argb hexadecimal format. Basically, I am trying to convert a color from Flex(AS3) into its appropriate kml color, which is in the argb hexadecimal format from…
user163757
  • 6,795
  • 9
  • 32
  • 47
3
votes
1 answer

C# - WinRT - Convert IPv4 address from uint to string?

I have a IPv4 address provided as a uint and I would like to convert it to string (for the purpose of logging). I would normally achieve this in C# using the System.Net.IPAddress constructor...but it seems that System.Net.IPAddress is not available…
DaveUK
  • 1,440
  • 3
  • 18
  • 31
3
votes
3 answers

1 byte integer doesn't convert i/o formats

I wrote the code below which inputs a number in hex format and outputs it in decimal form:- #include #include #include using namespace std; int main() { uint8_t c; cin>>hex>>c; cout<
AvinashK
  • 3,309
  • 8
  • 43
  • 94
3
votes
2 answers

Using two uint's to represent a double, then multiply?

I'm working with CUDA (GPGPU programming) for some research and the innate Double Precision performance suffers compares to the Single Precision performance (by a factor of 24!), due to a new hardware architecture. I've decided to try and use two…
JohnDoe
  • 77
  • 6
1 2
3
12 13