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
1 answer

Convert unsigned int to signed int through google BigQuery

I tried to run a query on google BigQuery api and got an exception as follows: "Argument type mismatch in function IF: 'distinctPlayers' is type 'TYPE_UINT64', '0' is type 'TYPE_INT32'." The query is too big so I wrote only part of it where it…
user1459963
  • 21
  • 1
  • 2
1
vote
5 answers

How to convert char to hex stored in uint8_t form?

Suppose I have these variables, const uint8_t ndef_default_msg[33] = { 0xd1, 0x02, 0x1c, 0x53, 0x70, 0x91, 0x01, 0x09, 0x54, 0x02, 0x65, 0x6e, 0x4c, 0x69, 0x62, 0x6e, 0x66, 0x63, 0x51, 0x01, 0x0b, 0x55, 0x03, 0x6c, 0x69, 0x62, 0x6e,…
Tyron Maples
  • 35
  • 1
  • 2
  • 6
1
vote
2 answers

initialize this buffer uint8*

I have this typedef typedef unsigned char uint8; and this variable public : uint8* bufferOfExchange; how could I initialize this buffer? bufferOfExchange = ???
curiousity
  • 4,703
  • 8
  • 39
  • 59
1
vote
1 answer

Type Casting in Chisel: Converting UInt to Int

I am working on a Chisel project and encountered an issue related to converting UInt to Int. I have tried using the litValue method, but it's giving me a None.get error when executing my code. I need guidance on how to correctly perform the…
1
vote
0 answers

numpy.uint(): transform float to uint gives [Totally] different results with large numbers

I was experimenting with numpy.uint() and numpy.around() Here is what I have done: >>> matrix = np.matrix([-32, -32.0, -3.91886975727153e-15]) >>> matrix matrix([[-3.20000000e+01, -3.20000000e+01, -3.91886976e-15]]) >>> np.uint(matrix) ... …
Qwerth
  • 21
  • 6
1
vote
2 answers

Read UInt types in binary

I am implementing a MidiReader And it need me to read weather MSB First or LSB First UInts(8, 16, 32 or 64). I know little about binary and types so I'm currently copying other's code from C#. class ByteArrayReader { public: unsigned char*…
Player01
  • 13
  • 3
1
vote
1 answer

Whats the best way to keep a number equal or greater than zero

What I want to achieve is to make sure that my property is always 0 or greater. The type doesn't matter. Lets say: var x = 3; var y = 5; And after x -= y x is supposed to be 0. Currently using this way and was wondering of there is a way without…
Bugrick
  • 19
  • 1
1
vote
0 answers

Failure to read the second line of file

I have updated my post to include all my code. My problem is I am testing my program with multiple text files and on one of them it successfully reads both lines where as the others it does not. Can someone please help me figure out why? Each file…
1
vote
1 answer

Parse Bytes Into Struct Attribute (int16_t) In C

I am trying to parse these bytes: 00000000: 4353 4333 3630 4653 >0200< >0000 1900< 0000 Into uint16_t and uint32_t struct attributes respectively. The struct at hand: typedef struct __packed { uint8_t fs_id [8]; uint16_t block_size; uint32_t…
1
vote
1 answer

How to prevent gorm from converting custom integer types into strings?

I have troubles while using gorm with custom types that have integer properties. Gorm tends to convert the integer values into strings for me. There are two separate problems: Problem 1: I have a custom type defined as follows: type ClientType…
Eric L.
  • 187
  • 1
  • 3
  • 10
1
vote
1 answer

How to force negative values to 0 in unsigned dtypes?

I want to substract one image from another one (both uint8 dtype) but if this operation leads to a negative number, it should return the max value of uint8 dtype (i.e : 255) How can I force it to return 0? Note: If possible i don't want to transform…
1
vote
1 answer

pass an unsigned variable as reference in java for a method implemented in C dll

I have a dll including some methods like this f(DWORD a, DWORD b, ulong *c) I have an example of declaring this method in C# as follows f(uint a, ref uint b, ref IntPtr c) now I want to implement the same in java. Neither uint nor ref are not…
1
vote
1 answer

TabView doesn't show the next N SelectionValue where SelectionValue == UInt

The code below doesn't show Text("Second View"), because private var selection: UInt. struct TabMenu: View { @State private var selection: UInt = 0 var body: some View { TabView(selection: $selection){ Text("First…
Nick Rossik
  • 1,048
  • 1
  • 6
  • 16
1
vote
2 answers

How to convert UInt to Int in swift?

I need to convert a variable from NSUInt to Int to pass it as argument to allocate. I tried initializing with Int() but the compiler refuses cannot invoke initializer for type 'int' with an argument of type '(UInt?)' this is the variable: NSUInteger…
Fakher Mokadem
  • 1,059
  • 1
  • 8
  • 22