best size for integer maths

General questions about Firewing...

best size for integer maths

Postby richardb » Wed Feb 12, 2014 10:01 am

on some of the windows compilers I've used it is generally recommended that you use native integer sizes as smaller sizes can be lower Performance.


What's the case with firewing ignoring any ram usage issues.


Is it faster doing 8 bit calculations with 32bit vars? or no difference? is the code size any different?

Richard
richardb
 
Posts: 63
Joined: Thu Aug 01, 2013 10:40 am

Re: best size for integer maths

Postby David John Barker » Wed Feb 12, 2014 10:33 am

The underlying core of 16 and 32 bit Microchip devices are very different (32 being a MIPS core) . However, sticking to native sizes will do no harm - a 16 bit MCU will have good support for 16 bit integer maths and a 32 bit MCU will have good support for 32 bit integer. It's impossible to say if code will be larger or smaller, it depends on what you are doing. 16 and 32 bit variables must be word aligned on 16 bit devices and 16 and 32 bit variables must be long word aligned on 32 bit devices so you will see differences in RAM usage but obviously they are aligned for optimal access for any given core. Personally, I don't really thing about it to much - I tend to use the variable I feel the program needs, rather than the core. I suspect you wouldn't really see much difference when using 8 or 16 bit variables on 32 core devices, but I'm no MIPS expert...
User avatar
David John Barker
 
Posts: 491
Joined: Thu Nov 08, 2012 12:21 pm


Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x