Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[General] Fixed width, minimum width and fastest minimum width unsigned 8 bit integer

Status
Not open for further replies.

shaswat

Advanced Member level 4
Joined
Jul 2, 2013
Messages
115
Helped
1
Reputation
2
Reaction score
1
Trophy points
18
Activity points
963
Hi All,

Last night I read an article on choosing correct integer size https://embeddedgurus.com/stack-overflow/2008/06/efficient-c-tips-1-choosing-the-correct-integer-size/. Before reading this article, I was unaware of these three keywords. These keywords are:

1) Fixed width unsigned 8-bit integer: uint8_t. (Keywords are C99 complaints)

2) Minimum width unsigned 8-bit integer: uint_least8_t.

3) Fastest minimum width unsigned 8-bit integer: uint_fast8_t.

So my question are:

1) What exactly they mean by saying "at least 8 bits wide" for uint_least8_t & uint_fast8_t. For example, let's take a look of snippet of code

Code:
                    for(u16 i=0;i<counter;i++)
                    {
                      Increment_Counter++;
                    }

When counter =0xFF; Increment_Counter will work fine by any type of keyword declaration.
Now when counter =0x01FF; what kind of declaration should I choose? uint_least8_t (who guaranteed to be at least 8 bits wide) or unit16 type?



1) How choosing uint_fast8_t affects the code speed.

2) How choosing uint_least8_t consumes lesser data memory than unsigned char.


Thanks in advance
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top