summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2010-10-24 03:23:59 +0200
committerDenys Vlasenko2010-10-24 03:23:59 +0200
commit738e4de01332a10edd30149aa998f8ed403c12ed (patch)
treed6ec6404e76ee5d661e4ddfe5e1809ff8acf4ef5
parent8f8ee534a7799cba8c953fffabe3b9c5571b3eb7 (diff)
downloadbusybox-738e4de01332a10edd30149aa998f8ed403c12ed.zip
busybox-738e4de01332a10edd30149aa998f8ed403c12ed.tar.gz
English fixes to docs/smallint.txt
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--docs/smallint.txt8
1 files changed, 5 insertions, 3 deletions
diff --git a/docs/smallint.txt b/docs/smallint.txt
index df67964..b57dfd7 100644
--- a/docs/smallint.txt
+++ b/docs/smallint.txt
@@ -8,14 +8,15 @@
I think that this optimization is wrong.
index_in_str_array returns int. At best, compiler will use it as-is.
-At worst, compiler will try to make sure that it is properly casted
+At worst, compiler will try to make sure that it is properly cast
into a byte, which probably results in "n = n & 0xff" on many architectures.
You save nothing on space here because i is not stored on-stack,
-gcc will keep it in register. And even it is *is* stored,
+gcc will keep it in register. And even if it *is* stored,
it is *stack* storage, which is cheap (unlike data/bss).
small[u]ints are useful _mostly_ for:
+
(a) flag variables
(a1) global flag variables - make data/bss smaller
(a2) local flag variables - "a = 5", "a |= 0x40" are smaller
@@ -26,10 +27,11 @@ small[u]ints are useful _mostly_ for:
movl $0x0,(%eax) is "c7 00 00 00 00 00"
movb $0x0,(%eax) is "c6 00 00"
(b) small integer structure members, when you have many such
-structures allocated,
+ structures allocated,
or when these are global objects of this structure type
small[u]ints are *NOT* useful for:
+
(a) function parameters and return values -
they are pushed on-stack or stored in registers, bytes here are *harder*
to deal with than ints