From owner-freebsd-hackers Sun Apr 6 03:02:12 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id DAA12721 for hackers-outgoing; Sun, 6 Apr 1997 03:02:12 -0700 (PDT) Received: from casparc.ppp.net ([194.64.12.35]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id DAA12698 for ; Sun, 6 Apr 1997 03:02:04 -0700 (PDT) Received: from ernie by casparc.ppp.net with uucp (Smail3.1.28.1 #1) id m0wDolu-000INaC; Sun, 6 Apr 97 12:02 MET DST Received: by ernie.kts.org via sendmail with stdio id for freebsd-hackers@freebsd.org; Sun, 6 Apr 1997 12:04:01 +0200 (MET DST) (Smail-3.2.0.91 1997-Jan-14 #2 built 1997-Feb-8) Message-Id: From: hm@kts.org (Hellmuth Michaelis) Subject: How to declare device driver variables and data structures ? To: freebsd-hackers@freebsd.org Date: Sun, 6 Apr 1997 12:04:01 +0200 (MET DST) Organization: Kitchen Table Systems Reply-To: hm@kts.org X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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