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

uint: Why is -(a*b) different from -a*b

I understand all of these apart from the last one: import numpy as np a = np.array(5).astype('uint16') a Out[24]: array(5, dtype=uint16) -a Out[25]: 65531 a*1. Out[26]: 5.0 -(a*1.) Out[27]: -5.0 0-a*1. Out[28]: -5.0 -a*1. Out[29]:…
konstanze
  • 511
  • 3
  • 12
2
votes
4 answers

Weird Data Types - C++

I know this sounds like a silly question, but I would like to know if it is possible in any way to make a custom variable size like this rather than using plain 8, 16, 32 and 64 bit integers: uint15_t var; //as an example I did some research online…
Packa
  • 173
  • 14
2
votes
1 answer

Uint and uintptr in golang

I know uintptr follow same rules for its size with uint in Go; I guess uint and uintptr are the same and only they are different in the use case. so why uintptr is not an alias for uint in go built-ins like how byte is an alias for uint8 and rune…
abgr
  • 63
  • 9
2
votes
2 answers

Parse JSON uint32/uint64 numbers in Java

I want to parse some JSON data in uint32 and uint64 format that are sent as numbers (without quotes), and then use them in java. I found out that I can store them as unsigned integers via the parseUnsignedInt(String) method, but the problem is that…
Yiorgos
  • 111
  • 8
2
votes
2 answers

What is the implication of using a specific numeric type over another

What is the memory implication of storing an integer as a particular numeric type (uint8, int16, uint32, int64, etc)? I know the range of integers each of the types can take, but is there some memory efficiency that can be achieved by using an…
Femi Sotonwa
  • 103
  • 1
  • 4
2
votes
1 answer

Precondition failed: Negative count not allowed

Error: Precondition failed: Negative count not allowed: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-900.0.74.1/src/swift/stdlib/public/core/StringLegacy.swift, line 49 Code: String(repeating: "a", count:…
henrique
  • 1,072
  • 10
  • 17
2
votes
2 answers

Convert CRC uint to QByteArray QT - C++

I've CRC value into uint that is: 95DF My target is return from uint two byte in QByteArray. I get this: `CRC uint 95DF //in simple i should return this QByteArray[0] = 95; QByteArray[1] = DF; I've tryed convert uint to QString but this one…
Mr. Developer
  • 3,295
  • 7
  • 43
  • 110
2
votes
2 answers

why chisel UInt(32.W) can not take a unsigned number which bit[32] happens to be 1?

It is defined that UInt is the type of unsigned integer. But in such case it seems like the MSB is still a sign. e.g., the most relative QA is Chisel UInt negative value error which works out a workaround but no why. Could you enlight me about the…
Lin Frank
  • 113
  • 11
2
votes
0 answers

C++ - Maintaining ABI - Interface parameter passing

I'm developing a library in DLL. To maintain ABI I have taken an approach to use interface which is exported to my client and implement that interface in my library. For my library to work I need large number of input parameters from user, for that…
Avi Mehta
  • 21
  • 3
2
votes
1 answer

Objective-C compatible Swift enum with NSUIntegerMax

I'm translating some code from Objective-C to Swift. typedef NS_ENUM(NSUInteger, SomeType) { SomeTypeZero = 0, SomeTypeOne = 1, SomeTypeMax = NSUIntegerMax }; However UInt.max gives me a compiler error: "Raw value for enum case must be…
I make my mark
  • 841
  • 6
  • 13
2
votes
1 answer

Julia NetCDF returns ondly Uint8

I'm migrating from matlab to Julia. Using julia v 0.4.2 and package NetCDF by Meggart I'm trying to import a variable the same way i import it in matlab: Tiempo = ncread(Arch,"Times")'; And, if i view the contents of the variable on Matlab i have:…
aramirezreyes
  • 1,345
  • 7
  • 16
2
votes
1 answer

Validating an if-condition with bitwise operators

I am facing a problem in dealing with basic if else statement in C#. I have two variables of type uint. I need to check whether the first variable is in the range of the second one. Also, the first variable can have value null. The output comes up…
Ayesha Gupta
  • 145
  • 4
  • 13
2
votes
0 answers

Changing datatype in GDAL (python)

I wrote a script to rasterize different vector files the one after the other, during this process you have to input the cost per pixel for that specific layer. Eventually I am trying to achieve one raster file containing all the initial vector files…
Peter Vanvoorden
  • 181
  • 1
  • 2
  • 11
2
votes
1 answer

What does uint8 function do?

I'm trying to show the negative of an image and as you know it has a very simple code. This is the original image: When I use the code: Out = 255-img; %Out = uint8(OutNeg); imshow(Out); The result will be: But using the code: OutNeg =…
Sepideh Abadpour
  • 2,550
  • 10
  • 52
  • 88
2
votes
1 answer

Casting UInt32 to Int32: Different compiler results

I was reading How can one simplify network byte-order conversion from a BinaryReader? and the initial code in the question made me think about the capabilities of the explicit cast between UInt32 and Int32. My main concern is with values greater…
Denise Skidmore
  • 2,286
  • 22
  • 51