1 /* The standard memset function.
3 Copyright (C) 2011 Richard Henderson
5 This file is part of QEMU PALcode.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the text
15 of the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not see
19 <http://www.gnu.org/licenses/>. */
24 void *memset(void *optr
, int ival
, unsigned long size
)
26 unsigned long val
= ival
;
29 if (__builtin_expect (size
== 0, 0))
32 if (__builtin_expect (val
!= 0, 0))
40 if (__builtin_expect ((unsigned long)ptr
& 1, 0))
47 if (__builtin_expect ((unsigned long)ptr
& 2, 0))
56 if (__builtin_expect ((unsigned long)ptr
& 4, 0))