source: trunk/libs/newlib/src/newlib/libc/machine/riscv/sys/string.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 791 bytes
Line 
1/* Copyright (c) 2017  SiFive Inc. All rights reserved.
2
3   This copyrighted material is made available to anyone wishing to use,
4   modify, copy, or redistribute it subject to the terms and conditions
5   of the FreeBSD License.   This program is distributed in the hope that
6   it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
7   including the implied warranties of MERCHANTABILITY or FITNESS FOR
8   A PARTICULAR PURPOSE.  A copy of this license is available at
9   http://www.opensource.org/licenses.
10*/
11
12#ifndef _SYS_STRING_H
13#define _SYS_STRING_H
14
15static __inline unsigned long __libc_detect_null(unsigned long w)
16{
17  unsigned long mask = 0x7f7f7f7f;
18  if (sizeof (long) == 8)
19    mask = ((mask << 16) << 16) | mask;
20  return ~(((w & mask) + mask) | w | mask);
21}
22
23#endif
Note: See TracBrowser for help on using the repository browser.