Source-Changes-HG archive

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

[src/trunk]: src lua: updated from 5.1 to 5.3 work3



details:   https://anonhg.NetBSD.org/src/rev/c963658a6761
branches:  trunk
changeset: 330735:c963658a6761
user:      lneto <lneto%NetBSD.org@localhost>
date:      Sat Jul 19 18:38:33 2014 +0000

description:
lua: updated from 5.1 to 5.3 work3

* lua(1):
  - changed lua_Integer to intmax_t
  - updated distrib/sets/lists and etc/mtree
  - updated bsd.lua.mk
  - fixed bozohttpd (lua-bozo.c)
  - compatibilized bindings: gpio, sqlite
* lua(4):
  - removed floating-point and libc dependencies using '#ifndef _KERNEL'
  - fixed division by zero and exponentiation
  - libkern: added isalnum(), iscntrl(), isgraph(), isprint() and ispunct()
  - acpica: removed isprint() from acnetbsd.h
  - libc: moved strcspn.c, strpbrk.c and strspn.c to common
  - removed stub headers
  - compatibilized bindings: luapmf, luasystm
* reorganized luaconf.h
* updated doc/CHANGES and doc/RESPONSIBLE

diffstat:

 common/lib/libc/string/strcspn.c                         |    74 +
 common/lib/libc/string/strpbrk.c                         |    79 +
 common/lib/libc/string/strspn.c                          |   155 +
 distrib/sets/lists/base/ad.arm                           |    14 +-
 distrib/sets/lists/base/ad.mips                          |    26 +-
 distrib/sets/lists/base/ad.powerpc                       |    14 +-
 distrib/sets/lists/base/md.amd64                         |    14 +-
 distrib/sets/lists/base/md.sparc64                       |    14 +-
 distrib/sets/lists/base/mi                               |     6 +-
 distrib/sets/lists/base/shl.mi                           |    12 +-
 distrib/sets/lists/debug/ad.arm                          |     4 +-
 distrib/sets/lists/debug/ad.mips                         |     6 +-
 distrib/sets/lists/debug/ad.powerpc                      |     4 +-
 distrib/sets/lists/debug/md.amd64                        |     4 +-
 distrib/sets/lists/debug/md.sparc64                      |     4 +-
 distrib/sets/lists/debug/shl.mi                          |     4 +-
 doc/CHANGES                                              |     3 +-
 doc/RESPONSIBLE                                          |     4 +-
 etc/mtree/NetBSD.dist.base                               |     6 +-
 etc/mtree/NetBSD.dist.earm                               |     4 +-
 etc/mtree/NetBSD.dist.mips64eb                           |     6 +-
 etc/mtree/NetBSD.dist.mips64el                           |     6 +-
 etc/mtree/NetBSD.dist.powerpc64                          |     4 +-
 etc/mtree/NetBSD.dist.sparc64                            |     4 +-
 etc/mtree/NetBSD.dist.x86_64                             |     4 +-
 external/mit/lua/dist/COPYRIGHT                          |    34 -
 external/mit/lua/dist/HISTORY                            |   183 -
 external/mit/lua/dist/INSTALL                            |    99 -
 external/mit/lua/dist/Makefile                           |   108 +-
 external/mit/lua/dist/README                             |    37 +-
 external/mit/lua/dist/doc/alert.png                      |   Bin 
 external/mit/lua/dist/doc/contents.html                  |   306 +-
 external/mit/lua/dist/doc/cover.png                      |   Bin 
 external/mit/lua/dist/doc/lua.1                          |   123 +-
 external/mit/lua/dist/doc/lua.css                        |    33 +-
 external/mit/lua/dist/doc/lua.html                       |   172 -
 external/mit/lua/dist/doc/luac.1                         |    88 +-
 external/mit/lua/dist/doc/luac.html                      |   145 -
 external/mit/lua/dist/doc/manual.css                     |     9 +-
 external/mit/lua/dist/doc/manual.html                    |  8309 ++++++++-----
 external/mit/lua/dist/doc/osi-certified-72x60.png        |   Bin 
 external/mit/lua/dist/doc/readme.html                    |   356 +-
 external/mit/lua/dist/etc/Makefile                       |    44 -
 external/mit/lua/dist/etc/README                         |    37 -
 external/mit/lua/dist/etc/all.c                          |    40 -
 external/mit/lua/dist/etc/lua.hpp                        |     9 -
 external/mit/lua/dist/etc/lua.ico                        |   Bin 
 external/mit/lua/dist/etc/lua.pc                         |    31 -
 external/mit/lua/dist/etc/luavs.bat                      |    28 -
 external/mit/lua/dist/etc/min.c                          |    41 -
 external/mit/lua/dist/etc/noparser.c                     |    52 -
 external/mit/lua/dist/etc/strict.lua                     |    41 -
 external/mit/lua/dist/src/Makefile                       |   167 +-
 external/mit/lua/dist/src/lapi.c                         |   985 +-
 external/mit/lua/dist/src/lapi.h                         |    18 +-
 external/mit/lua/dist/src/lauxlib.c                      |  1041 +-
 external/mit/lua/dist/src/lauxlib.h                      |   174 +-
 external/mit/lua/dist/src/lbaselib.c                     |   614 +-
 external/mit/lua/dist/src/lbitlib.c                      |   229 +
 external/mit/lua/dist/src/lcode.c                        |   544 +-
 external/mit/lua/dist/src/lcode.h                        |    37 +-
 external/mit/lua/dist/src/lcorolib.c                     |   171 +
 external/mit/lua/dist/src/lctype.c                       |    56 +
 external/mit/lua/dist/src/lctype.h                       |    99 +
 external/mit/lua/dist/src/ldblib.c                       |   364 +-
 external/mit/lua/dist/src/ldebug.c                       |   737 +-
 external/mit/lua/dist/src/ldebug.h                       |    34 +-
 external/mit/lua/dist/src/ldo.c                          |   724 +-
 external/mit/lua/dist/src/ldo.h                          |    35 +-
 external/mit/lua/dist/src/ldump.c                        |   287 +-
 external/mit/lua/dist/src/lfunc.c                        |   147 +-
 external/mit/lua/dist/src/lfunc.h                        |    34 +-
 external/mit/lua/dist/src/lgc.c                          |  1463 +-
 external/mit/lua/dist/src/lgc.h                          |   154 +-
 external/mit/lua/dist/src/linit.c                        |    50 +-
 external/mit/lua/dist/src/liolib.c                       |   644 +-
 external/mit/lua/dist/src/llex.c                         |   521 +-
 external/mit/lua/dist/src/llex.h                         |    37 +-
 external/mit/lua/dist/src/llimits.h                      |   156 +-
 external/mit/lua/dist/src/lmathlib.c                     |   334 +-
 external/mit/lua/dist/src/lmem.c                         |    49 +-
 external/mit/lua/dist/src/lmem.h                         |    32 +-
 external/mit/lua/dist/src/loadlib.c                      |   625 +-
 external/mit/lua/dist/src/lobject.c                      |   456 +-
 external/mit/lua/dist/src/lobject.h                      |   482 +-
 external/mit/lua/dist/src/lopcodes.c                     |    59 +-
 external/mit/lua/dist/src/lopcodes.h                     |   121 +-
 external/mit/lua/dist/src/loslib.c                       |   194 +-
 external/mit/lua/dist/src/lparser.c                      |  1068 +-
 external/mit/lua/dist/src/lparser.h                      |    86 +-
 external/mit/lua/dist/src/lstate.c                       |   321 +-
 external/mit/lua/dist/src/lstate.h                       |   154 +-
 external/mit/lua/dist/src/lstring.c                      |   205 +-
 external/mit/lua/dist/src/lstring.h                      |    25 +-
 external/mit/lua/dist/src/lstrlib.c                      |   795 +-
 external/mit/lua/dist/src/ltable.c                       |   367 +-
 external/mit/lua/dist/src/ltable.h                       |    23 +-
 external/mit/lua/dist/src/ltablib.c                      |   157 +-
 external/mit/lua/dist/src/ltm.c                          |    97 +-
 external/mit/lua/dist/src/ltm.h                          |    35 +-
 external/mit/lua/dist/src/lua.c                          |   601 +-
 external/mit/lua/dist/src/lua.h                          |   286 +-
 external/mit/lua/dist/src/lua.hpp                        |     9 +
 external/mit/lua/dist/src/luac.c                         |   347 +-
 external/mit/lua/dist/src/luaconf.h                      |  1055 +-
 external/mit/lua/dist/src/lualib.h                       |    33 +-
 external/mit/lua/dist/src/lundump.c                      |   399 +-
 external/mit/lua/dist/src/lundump.h                      |    39 +-
 external/mit/lua/dist/src/lutf8lib.c                     |   255 +
 external/mit/lua/dist/src/lvm.c                          |  1472 +-
 external/mit/lua/dist/src/lvm.h                          |    35 +-
 external/mit/lua/dist/src/lzio.c                         |    38 +-
 external/mit/lua/dist/src/lzio.h                         |    15 +-
 external/mit/lua/dist/src/print.c                        |   229 -
 external/mit/lua/dist/test/README                        |    26 -
 external/mit/lua/dist/test/bisect.lua                    |    27 -
 external/mit/lua/dist/test/cf.lua                        |    16 -
 external/mit/lua/dist/test/echo.lua                      |     5 -
 external/mit/lua/dist/test/env.lua                       |     7 -
 external/mit/lua/dist/test/factorial.lua                 |    32 -
 external/mit/lua/dist/test/fib.lua                       |    40 -
 external/mit/lua/dist/test/fibfor.lua                    |    13 -
 external/mit/lua/dist/test/globals.lua                   |    13 -
 external/mit/lua/dist/test/hello.lua                     |     3 -
 external/mit/lua/dist/test/life.lua                      |   111 -
 external/mit/lua/dist/test/luac.lua                      |     7 -
 external/mit/lua/dist/test/printf.lua                    |     7 -
 external/mit/lua/dist/test/readonly.lua                  |    12 -
 external/mit/lua/dist/test/sieve.lua                     |    29 -
 external/mit/lua/dist/test/sort.lua                      |    66 -
 external/mit/lua/dist/test/table.lua                     |    12 -
 external/mit/lua/dist/test/trace-calls.lua               |    32 -
 external/mit/lua/dist/test/trace-globals.lua             |    38 -
 external/mit/lua/dist/test/xd.lua                        |    14 -
 external/mit/lua/lib/liblua/Makefile                     |    15 +-
 external/mit/lua/lib/liblua/shlib_version                |     6 +-
 external/mit/lua/usr.bin/luac/Makefile                   |     4 +-
 lib/libc/string/strcspn.c                                |    70 -
 lib/libc/string/strpbrk.c                                |    75 -
 lib/libc/string/strspn.c                                 |   151 -
 lib/lua/gpio/gpio.c                                      |     8 +-
 lib/lua/sqlite/sqlite.c                                  |    12 +-
 libexec/httpd/lua-bozo.c                                 |    12 +-
 share/examples/lua/gpio.lua                              |     4 +-
 share/examples/lua/sqlite.lua                            |     4 +-
 share/mk/bsd.lua.mk                                      |     4 +-
 sys/external/bsd/acpica/dist/include/platform/acnetbsd.h |     8 +-
 sys/lib/libkern/Makefile.libkern                         |     6 +-
 sys/lib/libkern/libkern.h                                |    41 +-
 sys/modules/lua/Makefile                                 |    41 +-
 sys/modules/lua/assert.h                                 |    34 -
 sys/modules/lua/ctype.h                                  |    66 -
 sys/modules/lua/limits.h                                 |     8 -
 sys/modules/lua/locale.h                                 |    47 -
 sys/modules/lua/lua.c                                    |     8 +-
 sys/modules/lua/math.h                                   |     6 -
 sys/modules/lua/setjmp.h                                 |    10 -
 sys/modules/lua/signal.h                                 |     6 -
 sys/modules/lua/stddef.h                                 |    10 -
 sys/modules/lua/stdio.h                                  |    49 -
 sys/modules/lua/stdlib.h                                 |    45 -
 sys/modules/lua/string.h                                 |    21 -
 sys/modules/lua/test.lua                                 |     6 +-
 sys/modules/luapmf/Makefile                              |     6 +-
 sys/modules/luapmf/luapmf.c                              |     4 +-
 sys/modules/luasystm/Makefile                            |     6 +-
 sys/modules/luasystm/luasystm.c                          |     4 +-
 sys/modules/luasystm/test.lua                            |     2 +-
 168 files changed, 18928 insertions(+), 13201 deletions(-)

diffs (truncated from 44840 to 300 lines):

diff -r 77806978db37 -r c963658a6761 common/lib/libc/string/strcspn.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/string/strcspn.c  Sat Jul 19 18:38:33 2014 +0000
@@ -0,0 +1,74 @@
+/*     $NetBSD: strcspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $        */
+
+/*-
+ * Copyright (c) 2008 Joerg Sonnenberger
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: strcspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $");
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <assert.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <string.h>
+#else
+#include <lib/libkern/libkern.h>
+#endif
+
+/* 64bit version is in strspn.c */
+#if ULONG_MAX != 0xffffffffffffffffull
+
+size_t
+strcspn(const char *s, const char *charset)
+{
+       static const uint8_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
+       const char *t;
+       uint8_t set[32];
+#define UC(a) ((unsigned int)(unsigned char)(a))
+
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(charset != NULL);
+
+       if (charset[0] == '\0')
+               return strlen(s);
+       if (charset[1] == '\0') {
+               for (t = s; *t != '\0'; ++t)
+                       if (*t == *charset)
+                               break;
+               return t - s;
+       }
+
+       (void)memset(set, 0, sizeof(set));
+
+       for (; *charset != '\0'; ++charset)
+               set[UC(*charset) >> 3] |= idx[UC(*charset) & 7];
+
+       for (t = s; *t != '\0'; ++t)
+               if (set[UC(*t) >> 3] & idx[UC(*t) & 7])
+                       break;
+       return t - s;
+}
+
+#endif
diff -r 77806978db37 -r c963658a6761 common/lib/libc/string/strpbrk.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/string/strpbrk.c  Sat Jul 19 18:38:33 2014 +0000
@@ -0,0 +1,79 @@
+/*     $NetBSD: strpbrk.c,v 1.1 2014/07/19 18:38:33 lneto Exp $        */
+
+/*-
+ * Copyright (c) 2008 Joerg Sonnenberger
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: strpbrk.c,v 1.1 2014/07/19 18:38:33 lneto Exp $");
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <assert.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <string.h>
+#else
+#include <lib/libkern/libkern.h>
+#endif
+
+#define FAST_STRPBRK 1
+#define UC(a) ((unsigned int)(unsigned char)(a))
+
+#ifdef FAST_STRPBRK
+#define ADD_NEW_TO_SET(i) (set[inv[i] = idx++] = (i))
+#define IS_IN_SET(i) (inv[i] < idx && set[inv[i]] == (i))
+#define ADD_TO_SET(i) (void)(IS_IN_SET(i) || /*LINTED no effect*/ADD_NEW_TO_SET(i))
+#else
+#define IS_IN_SET(i) (set[(i) >> 3] & idx[(i) & 7])
+#define ADD_TO_SET(i) (void)(set[(i) >> 3] |= idx[(i) & 7])
+#endif
+
+char *
+strpbrk(const char *s, const char *charset)
+{
+#ifdef FAST_STRPBRK
+       uint8_t set[256], inv[256], idx = 0;
+#else
+       static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
+       uint8_t set[32];
+
+       (void)memset(set, 0, sizeof(set));
+#endif
+
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(charset != NULL);
+
+       if (charset[0] == '\0')
+               return NULL;
+       if (charset[1] == '\0')
+               return strchr(s, charset[0]);
+
+       for (; *charset != '\0'; ++charset)
+               ADD_TO_SET(UC(*charset));
+
+       for (; *s != '\0'; ++s)
+               if (IS_IN_SET(UC(*s)))
+                       return __UNCONST(s);
+       return NULL;
+}
diff -r 77806978db37 -r c963658a6761 common/lib/libc/string/strspn.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/common/lib/libc/string/strspn.c   Sat Jul 19 18:38:33 2014 +0000
@@ -0,0 +1,155 @@
+/*     $NetBSD: strspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $ */
+
+/*-
+ * Copyright (c) 2008 Joerg Sonnenberger
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: strspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $");
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <assert.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <string.h>
+#else
+#include <lib/libkern/libkern.h>
+#endif
+
+#if ULONG_MAX != 0xffffffffffffffffull
+
+size_t
+strspn(const char *s, const char *charset)
+{
+       static const uint8_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
+       uint8_t set[32];
+       const char *t;
+#define UC(a) ((unsigned int)(unsigned char)(a))
+
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(charset != NULL);
+
+       if (charset[0] == '\0')
+               return 0;
+       if (charset[1] == '\0') {
+               for (t = s; *t != '\0'; ++t) {
+                       if (*t != *charset)
+                               break;
+               }
+               return t - s;
+       }
+
+       (void)memset(set, 0, sizeof(set));
+
+       for (; *charset != '\0'; ++charset)
+               set[UC(*charset) >> 3] |= idx[UC(*charset) & 7];
+
+       for (t = s; *t != '\0'; ++t)
+               if ((set[UC(*t) >> 3] & idx[UC(*t) & 7]) == 0)
+                       break;
+       return t - s;
+}
+
+#else
+
+/* 64 bit system, use four 64 bits registers for bitmask */
+
+static size_t
+strspn_x(const char *s_s, const char *charset_s, unsigned long invert)
+{
+       const unsigned char *s = (const unsigned char *)s_s;
+       const unsigned char *charset = (const unsigned char *)charset_s;
+       unsigned long m_0, m_4, m_8, m_c;
+       unsigned char ch, next_ch;
+       unsigned long bit;
+       unsigned long check;
+       size_t count;
+
+       /* Four 64bit registers have one bit for each character value */
+       m_0 = 0;
+       m_4 = 0;
+       m_8 = 0;
+       m_c = 0;
+
+       for (ch = *charset; ch != 0; ch = next_ch) {
+               next_ch = *++charset;
+               bit = 1ul << (ch & 0x3f);
+               if (__predict_true(ch < 0x80)) {
+                       if (ch < 0x40)
+                               m_0 |= bit;
+                       else
+                               m_4 |= bit;
+               } else {
+                       if (ch < 0xc0)
+                               m_8 |= bit;
+                       else
+                               m_c |= bit;
+               }
+       }
+
+       /* For strcspn() we just invert the validity set */
+       m_0 ^= invert;
+       m_4 ^= invert;
+       m_8 ^= invert;
+       m_c ^= invert;
+
+       /*
+        * We could do remove the lsb from m_0 to terminate at the
+        * end of the input string.
+        * However prefetching the next char is benifitial and we must
+        * not read the byte after the \0 - as it might fault!
+        * So we take the 'hit' of the compare against 0.
+        */
+
+       ch = *s++;
+       for (count = 0; ch != 0; ch = next_ch) {
+               next_ch = s[count];
+               if (__predict_true(ch < 0x80)) {
+                       check = m_0;
+                       if (ch >= 0x40)
+                               check = m_4;
+               } else {
+                       check = m_8;
+                       if (ch >= 0xc0)
+                               check = m_c;



Home | Main Index | Thread Index | Old Index