1 /* Copyright (c) 2017 SiFive Inc. All rights reserved.
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.
15 static __inline
unsigned long __libc_detect_null(unsigned long w
)
17 unsigned long mask
= 0x7f7f7f7f;
18 if (sizeof (long) == 8)
19 mask
= ((mask
<< 16) << 16) | mask
;
20 return ~(((w
& mask
) + mask
) | w
| mask
);