Questions tagged [uint32-t]

uint32_t is 32-bit unsigned integer type. To get this type in your program include or . (corresponding C++ files if you want these types in a C++ code)

Use PRIu32 and SCNu32 to print and scanf this type.

67 questions
81
votes
9 answers

'uint32_t' does not name a type

I'm trying to compile a C++ software package that was written in 2007 and I'm getting this error: error: ‘uint32_t’ does not name a type This is happening in 64-bit Ubuntu using g++ 4.5.2. It compiles fine on 64-bit CentOS using g++ 4.1.2. Is there…
rmtheis
  • 6,978
  • 9
  • 56
  • 74
79
votes
2 answers

Difference between uint32 and uint32_t

Possible Duplicate: Difference between different integer types What is the difference between uint32 and uint32_t in C/C++? Are they OS-dependent? In which case should I use one or another?
Maxbester
  • 2,207
  • 7
  • 37
  • 64
25
votes
4 answers

What is *(uint32_t*)?

I have a hard time understanding *(uint32_t*). Let's say that I have: uint32_t* ptr; uint32_t num *(uint32_t*)(ptr + num); // What does this do? Does it
Hoa.N
  • 273
  • 1
  • 3
  • 7
21
votes
2 answers

When should I use UINT32_C(), INT32_C(),... macros in C?

I switched to fixed-length integer types in my projects mainly because they help me think about integer sizes more clearly when using them. Including them via #include also includes a bunch of other macros like the printing macros…
TimFinnegan
  • 549
  • 4
  • 17
8
votes
2 answers

How to print hex from uint32_t?

The code I have been working on requires that I print a variable of type uint32_t in hexadecimal, with a padding of 0s and minimum length 8. The code I have been using to do this so far is: printf("%08lx\n",read_word(address)); Where read_word…
Dave
  • 462
  • 1
  • 3
  • 14
7
votes
1 answer

How can i convert a uint32_t to a char* type

Hello i am using an Arduino UNO with an adafruit shield to display score values but the function used to display scores only accepts char* values and the score itself can occupy up to 6 digits(000,000 to 999,999). i have tried using sprint() but i…
blu
  • 281
  • 1
  • 5
  • 15
3
votes
1 answer

How to convert uint32_t to unsigned char array?

I'm trying to replicate conversion uint32_t values to unsigned char arrays in python (I've already done it in C) This is my existing C function: unsigned char *uint32_to_char_array(const uint32_t n) { unsigned char *a; a = wrap_calloc(4,…
bph
  • 9,306
  • 10
  • 51
  • 120
3
votes
3 answers

converting data types in c

Let me start by saying that I openly admit this is for a homework assignment, but what I am asking is not related to the purpose of the assignment, just something I don't understand in C. This is just a very small part of a large program. So my…
cHam
  • 2,454
  • 6
  • 20
  • 28
3
votes
1 answer

How to convert UIColor RGB Color to uint32_t Value

How to convert UIColor object to uint32_t value. Please let me know if any one aware of this? Here is the code: const CGFloat *components = CGColorGetComponents([UIColor redColor].CGColor); CGFloat r = components[0]; CGFloat g =…
Sandeep Sachan
  • 373
  • 2
  • 15
2
votes
4 answers

How does an uint32_t pointer work in this code?

I'm really confused by how uint32_t pointers work in C++ I was just fiddling around trying to learn TEA, and I didn't understand when they passed a uint32_t parameter to the encrypt function, and then in the function declared a uint32_t variable and…
Andronius
  • 47
  • 1
  • 5
2
votes
2 answers

Use of enum, uint32_t, and bit shifting in Objective C UIFontDescriptor.h constants

I'm getting introduced to objective C and have a mild understanding of enum types. Here is a piece of sample code seen here used in the tutorial I'm following: UIFont *bodyFont = [UIFont…
geeves31
  • 35
  • 6
2
votes
3 answers

Can data types saved in PROGMEM be changed later on in the program?

Hello i am making a game on an Arduino but i need to store 2 global variables that keep track of the score currScor and hiScor both of type uint32_t and to save ram space i marked them as uint32_t currScor PROGMEM = 0; once the game starts the score…
blu
  • 281
  • 1
  • 5
  • 15
2
votes
3 answers

C changing a bit of uint32_t not working

I got uint32_t bits = 0; bits |= 1<< 31; bits |= 1<< 15; bits |= 1<< 14; bits |= 1<< 13; which gives me 10000000000000001110000000000000 and in another function I do *(bits) |= 0 << 15; but it doesn't do anything, it should change the 16th 1 to a…
codeoverflow
  • 143
  • 2
  • 11
2
votes
4 answers

Reading and changing bits in C uint32_t

I am using this code int get_bit(int n, int bitnr) { int mask = 1 << bitnr; int masked_n = n & mask; int thebit = masked_n >> bitnr; return thebit; } void printbits(uint32_t bits) { int i; for (i = 0; i < 32; i++) printf("%d",…
codeoverflow
  • 143
  • 2
  • 11
2
votes
2 answers

Arduino converting between uint32_t and unsigned chars

I'm using the rainbowduino and it has some methods that take individual r g b values as unsigned chars, and some that take a 24bit rgb colour code. I want to convert r g b values into this 24bit colour code of type uint32_t (so that all my code only…
holmeswatson
  • 919
  • 2
  • 12
  • 33
1
2 3 4 5