## Using cstdint

Discussion related to the implementation of new features & algorithms to the Core Engine.

Moderators: jromang, tomb, zcott, coordinators

### Using cstdint

A lot of places in the core it's crucial to use bit-specific integers. The cstdint header provides these, however we use boost's platform compatible version.

Since this header is used in a lot of different places, would it be ok to include it in lux.h and pull the most common ones into the lux namespace?

edit: ie put the following in lux.h:
Code: Select all
#include <boost/cstdint.hpp>using boost::int8_t;using boost::uint8_t;...
May contain traces of nuts.

Lord Crc

Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Using cstdint

Hi,

We use boost version only because MSVC didn't support those types through cstdint, does it now?
If MSVC does support those types through cstdint then let's use cstdint instead of the boost version, that'll be cleaner.

Jeanphi
jeanphi

Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

### Re: Using cstdint

Correct, msvc doesn't support C99, and I think it's too early to mess with C++11. I'm mainly curious if there were any arguments against pulling those types into lux namespace
May contain traces of nuts.

Lord Crc

Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Using cstdint

Hi,

No problem with me, we won't have any type named like that. However are the explicit length types used that much? I had the impression that int and u_int where much more common. The issue with such an include is that it is going to drag a lot of boost headers with it for all compiled files and it can severely impact the build time.

Jeanphi
jeanphi

Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

### Re: Using cstdint

The boost/cstdint.hpp "only" drags with it the config headers, nothing else.

The reason I wanted to include it in lux.h is because the atomic operations defined in osfunc.h are only valid for 32bit unsigned integers, and I feel it's "dirty" to use "unsigned int" for that. Better to use uint32_t.

Also I got a small but noticeable speedboost using uint16_t for the contribution indexes (buffer/tile index and buffer group). Thus I include it in contribution.h. So from what I can see we already include it in a lot of core files anyway, might just go the full mile for the other files that need them?
May contain traces of nuts.

Lord Crc

Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

### Re: Using cstdint

Hi,

Ok, like I said, fine with me.

Jeanphi
jeanphi

Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

### Re: Using cstdint

Hi,

As a side note, in osfunc.h, instead of using casts, it'd be better to change the function prototypes to match the required types.

Jeanphi
jeanphi

Posts: 6577
Joined: Mon Jan 14, 2008 7:21 am

### Re: Using cstdint

Yes, that was exactly one of the reasons I wanted to pull in cstdint

I'll go ahead then
May contain traces of nuts.

Lord Crc

Posts: 4455
Joined: Sat Nov 17, 2007 2:10 pm

Return to Architecture & Design

### Who is online

Users browsing this forum: No registered users and 0 guests