Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Add memchr_inv ...



details:   https://anonhg.NetBSD.org/src/rev/dca251d9dd79
branches:  riastradh-drm2
changeset: 788315:dca251d9dd79
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jul 24 03:13:03 2013 +0000

description:
Add memchr_inv to <linux/string.h>.

diffstat:

 sys/external/bsd/drm2/include/linux/string.h |  18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 9b9cd202aa91 -r dca251d9dd79 sys/external/bsd/drm2/include/linux/string.h
--- a/sys/external/bsd/drm2/include/linux/string.h      Wed Jul 24 03:12:48 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/string.h      Wed Jul 24 03:13:03 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: string.h,v 1.1.2.1 2013/07/24 00:33:12 riastradh Exp $ */
+/*     $NetBSD: string.h,v 1.1.2.2 2013/07/24 03:13:03 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,4 +32,20 @@
 #ifndef _LINUX_STRING_H_
 #define _LINUX_STRING_H_
 
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+static inline void *
+memchr_inv(const void *buffer, int c, size_t len)
+{
+       const uint8_t byte = c; /* XXX lose */
+       const char *p;
+
+       for (p = buffer; len-- > 0; p++)
+               if (*p != byte)
+                       return __UNCONST(p);
+
+       return NULL;
+}
+
 #endif  /* _LINUX_STRING_H_ */



Home | Main Index | Thread Index | Old Index