Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 1997 12:04:01 +0200 (MET DST)
From:      hm@kts.org (Hellmuth Michaelis)
To:        freebsd-hackers@freebsd.org
Subject:   How to declare device driver variables and data structures ?
Message-ID:  <m0wDonp-00002GC@ernie.kts.org>

next in thread | raw e-mail | index | archive | help

Inside a device driver or a piece of kernel software, how should one decleare
the size of variables (if one has the choice):

i.e. if i know a variable can only have values 0 ... 32, shall i make it
an unsigned char ? Is it slower to make such variables an unsigned int
or an unsigned short ? What are the space vs. speed considerations ?

i.e. if i know a variable can only have values 0 ... 2048, shall i make it
an unsigned short ? Is it slower to make such variables an unsigned int ?

another i.e. for boolean variables, is it better to make them chars, shorts
or ints ? signed or unsigned ?

What is the speed of unsigned variables vs. signed variables ?

What is with future ports to other architectures ?

How does this all apply to variables being part of structures ?

hellmuth
-- 
hellmuth michaelis                hm@kts.org                    hamburg, europe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0wDonp-00002GC>