1 | /* |
1 | /* |
2 | * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de> |
2 | * Copyright (c) 2000-2010 Marc Alexander Lehmann <schmorp@schmorp.de> |
3 | * |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without modifica- |
4 | * Redistribution and use in source and binary forms, with or without modifica- |
5 | * tion, are permitted provided that the following conditions are met: |
5 | * tion, are permitted provided that the following conditions are met: |
6 | * |
6 | * |
7 | * 1. Redistributions of source code must retain the above copyright notice, |
7 | * 1. Redistributions of source code must retain the above copyright notice, |
… | |
… | |
34 | * either the BSD or the GPL. |
34 | * either the BSD or the GPL. |
35 | */ |
35 | */ |
36 | |
36 | |
37 | #include "lzfP.h" |
37 | #include "lzfP.h" |
38 | |
38 | |
39 | #include <string.h> /* for memcpy/memset */ |
|
|
40 | |
|
|
41 | #if AVOID_ERRNO |
39 | #if AVOID_ERRNO |
42 | # define SET_ERRNO(n) |
40 | # define SET_ERRNO(n) |
43 | #else |
41 | #else |
44 | # include <errno.h> |
42 | # include <errno.h> |
45 | # define SET_ERRNO(n) errno = (n) |
43 | # define SET_ERRNO(n) errno = (n) |
46 | #endif |
44 | #endif |
47 | |
45 | |
|
|
46 | #define USE_REP_MOVSB 1 |
48 | #if USE_REP_MOVSB /* small win on amd, big loss on intel */ |
47 | #if USE_REP_MOVSB /* small win on amd, big loss on intel */ |
49 | #if (__i386 || __amd64) && __GNUC__ >= 3 |
48 | #if (__i386 || __amd64) && __GNUC__ >= 3 |
50 | # define lzf_movsb(dst, src, len) \ |
49 | # define lzf_movsb(dst, src, len) \ |
51 | asm ("rep movsb" \ |
50 | asm ("rep movsb" \ |
52 | : "=D" (dst), "=S" (src), "=c" (len) \ |
51 | : "=D" (dst), "=S" (src), "=c" (len) \ |