22#if !defined(__GNUC__) || (__GNUC__ < 3)
23#define __builtin_expect(a,b) a
38#define UNROLL_FACTOR 4
40#elif (UNROLL_FACTOR != 2) && (UNROLL_FACTOR != 4)
41#error "UNROLL_FACTOR must be 2 or 4"
46strncpy (
char *dst0,
const char *src0,
size_t count)
48#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) || defined(__mips16) || !defined(__GNUC__) || (__GNUC__ < 3)
59 if (__builtin_expect (ch ==
'\0', 0))
72 unsigned char *dst_end;
74 const unsigned char *src;
83 dst = (
unsigned char *)dst0;
84 src = (
unsigned const char *)src0;
91 while (((uintptr_t) src & (UNROLL_FACTOR - 1)) != 0 &&
count > 0)
105 if (__builtin_expect (
count >= 4, 1))
107 odd_bytes = (
count & (UNROLL_FACTOR - 1));
118 src += UNROLL_FACTOR;
119 count -= UNROLL_FACTOR;
139 dst += UNROLL_FACTOR;
150 *dst++ = ch = *src++;
189 dst += UNROLL_FACTOR;
193 while (
count && (((
long)dst) & (
sizeof (word_type) - 1)) != 0)
199 while (
count >= UNROLL_FACTOR*
sizeof (word_type))
201 count -= UNROLL_FACTOR*
sizeof (word_type);
202 dst += UNROLL_FACTOR*
sizeof (word_type);
204 ((word_type *)(
void *)dst)[-4] = 0;
205 ((word_type *)(
void *)dst)[-3] = 0;
207 ((word_type *)(
void *)dst)[-2] = 0;
208 ((word_type *)(
void *)dst)[-1] = 0;
212 if (
count >= 2*
sizeof (word_type))
214 count -= 2*
sizeof (word_type);
215 ((word_type *)(
void *)dst)[0] = 0;
216 ((word_type *)(
void *)dst)[1] = 0;
217 dst += 2*
sizeof (word_type);
221 if (
count >=
sizeof (word_type))
223 count -=
sizeof (word_type);
224 ((word_type *)(
void *)dst)[0] = 0;
225 dst +=
sizeof (word_type);
229 if (
count >=
sizeof (si_type))
231 count -=
sizeof (si_type);
232 ((si_type *)(
void *)dst)[0] = 0;
233 dst +=
sizeof (si_type);
237 if (
count >=
sizeof (hi_type))
239 count -=
sizeof (hi_type);
240 ((hi_type *)(
void *)dst)[0] = 0;
241 dst +=
sizeof (hi_type);
u32 count
start sector of fragmented bd/file