Commit Graph

12 Commits

Author SHA1 Message Date
Xiang Xiao ba3f12c93f libc: Implement popcount/popcountl/popcountll
specified here:
https://www.unix.com/man-page/netbsd/3/popcountll/

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-21 07:37:04 -07:00
Xiang Xiao 5c67eac27f libc: Change index/rindex from macro to function
to avoid the confliction with the same name variable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-05 04:39:03 -07:00
Xiang Xiao 60fe0a0f96 libc: Refine the inline handling
1.Remove CONFIG_HAVE_INLINE macro
2.Change the ANSI C function to normal function
3.Other simple non ANSI function to macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-04 11:10:29 +09:00
Xiang Xiao a7174cee30 libc: Unify the selection of inline or macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I44a26550ff856af07d2d96a6f0a6066f988d6da3
2020-06-02 09:32:25 -06:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Jussi Kivilinna d0c54039dc Add ffsl(), ffsll(), fls(), flsl(), flsll() and use GCC's __builtin_ctz/__builtin_clz for faster implementation of these 2017-03-24 09:41:31 -06:00
Gregory Nutt 8c7ec7419a Eliminate a warning 2017-02-22 14:04:06 -06:00
Gregory Nutt 4539988d00 Removed CONFIG_LIBC_ARCH_BZERO. bzero() is a deprecated interface. There are no architecture-specific replacements and, if there were, they should replace memset(), not bzero(). 2017-02-22 10:41:49 -06:00
Gregory Nutt fb0e4d66c0 Fix ordering of parameters in call to memmove() in strings.h. Noted by David Sidrane. 2017-02-22 10:34:10 -06:00
Gregory Nutt cb7c5f9921 Implement strings.h macros as inline functions when possible for better C++ compatibility. 2017-02-22 10:20:58 -06:00
Gregory Nutt 22a8c2178d cstring: undefine macros defined in new strings.h. 2017-02-22 06:59:39 -06:00
Gregory Nutt 4f5879f998 C library: Add ffs(). Add strings.h. Move strcasecmp, strncasecmp, bzero, bcmp, and bcopy to where they belong in strings.h.h, not string.h. bzero, bcmp, and bcopy are legacy functions; the contemporary counterparts should be used instead. 2017-02-16 16:10:09 -06:00