projects
/
free-sw
/
xcb
/
libxcb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3f79628
)
added xcb_sumof() with restriction to uint8_t
author
Christoph Reimann
<oss@arcor.de>
Tue, 13 Jul 2010 17:56:44 +0000
(19:56 +0200)
committer
Christoph Reimann
<oss@arcor.de>
Tue, 13 Jul 2010 17:56:44 +0000
(19:56 +0200)
src/xcb_util.c
patch
|
blob
|
history
src/xcbext.h
patch
|
blob
|
history
diff --git
a/src/xcb_util.c
b/src/xcb_util.c
index
8c2a031
..
58bd12d
100644
(file)
--- a/
src/xcb_util.c
+++ b/
src/xcb_util.c
@@
-59,6
+59,16
@@
int xcb_popcount(uint32_t mask)
return ((y + (y >> 3)) & 030707070707) % 077;
}
+int xcb_sumof(uint8_t *list, int len)
+{
+ int i, s = 0;
+ for(i=0; i<len; i++) {
+ s += *list;
+ list++;
+ }
+ return s;
+}
+
static int _xcb_parse_display(const char *name, char **host, char **protocol,
int *displayp, int *screenp)
{
diff --git
a/src/xcbext.h
b/src/xcbext.h
index
2e10ba2
..
eb69538
100644
(file)
--- a/
src/xcbext.h
+++ b/
src/xcbext.h
@@
-86,6
+86,7
@@
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply,
/* xcb_util.c */
int xcb_popcount(uint32_t mask);
+int xcb_sumof(uint8_t *list, int len);
#ifdef __cplusplus
}