aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/mi/miscanfill.h
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-29 13:09:57 +1000
committerMike DePaulo <mikedep333@gmail.com>2015-02-17 21:23:43 -0500
commit3937db18a203f9936387286b95328f27013a5ffe (patch)
tree8da4e05a2c24642612ad684cb68db76fd220a1b5 /nx-X11/programs/Xserver/mi/miscanfill.h
parentd6ce946f9c0bb5746b8333b3f589aa8527739431 (diff)
downloadnx-libs-3937db18a203f9936387286b95328f27013a5ffe.tar.gz
nx-libs-3937db18a203f9936387286b95328f27013a5ffe.tar.bz2
nx-libs-3937db18a203f9936387286b95328f27013a5ffe.zip
include: introduce byte counting functions.
This patch adds the following three functions: bits_to_bytes(bits) - the number of bytes needed to hold 'bits' bytes_to_int32(bytes) - the number of 4-byte units to hold 'bytes' pad_to_int32(bytes) - the closest multiple of 4 equal to or larger than 'bytes'. All three operations are common in protocol processing and currently the server has ((foo + 7)/8 + 3)/4 operations all over the place. A common set of functions reduce the error rate of these (albeit simple) calculations and improve readability of the code. The functions do not check for overflow. v2: backport to nx-libs 3.6.x as a prereq for the CVE-2015-0255 fix (Mike DePaulo) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'nx-X11/programs/Xserver/mi/miscanfill.h')
0 files changed, 0 insertions, 0 deletions