Blame src/lzo_ptr.h

Packit Service 5195f2
/* lzo_ptr.h -- low-level pointer constructs
Packit Service 5195f2
Packit Service 5195f2
   This file is part of the LZO real-time data compression library.
Packit Service 5195f2
Packit Service 5195f2
   Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
Packit Service 5195f2
   All Rights Reserved.
Packit Service 5195f2
Packit Service 5195f2
   The LZO library is free software; you can redistribute it and/or
Packit Service 5195f2
   modify it under the terms of the GNU General Public License as
Packit Service 5195f2
   published by the Free Software Foundation; either version 2 of
Packit Service 5195f2
   the License, or (at your option) any later version.
Packit Service 5195f2
Packit Service 5195f2
   The LZO library is distributed in the hope that it will be useful,
Packit Service 5195f2
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 5195f2
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 5195f2
   GNU General Public License for more details.
Packit Service 5195f2
Packit Service 5195f2
   You should have received a copy of the GNU General Public License
Packit Service 5195f2
   along with the LZO library; see the file COPYING.
Packit Service 5195f2
   If not, write to the Free Software Foundation, Inc.,
Packit Service 5195f2
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Packit Service 5195f2
Packit Service 5195f2
   Markus F.X.J. Oberhumer
Packit Service 5195f2
   <markus@oberhumer.com>
Packit Service 5195f2
   http://www.oberhumer.com/opensource/lzo/
Packit Service 5195f2
 */
Packit Service 5195f2
Packit Service 5195f2
Packit Service 5195f2
/* WARNING: this file should *not* be used by applications. It is
Packit Service 5195f2
   part of the implementation of the library and is subject
Packit Service 5195f2
   to change.
Packit Service 5195f2
 */
Packit Service 5195f2
Packit Service 5195f2
Packit Service 5195f2
#ifndef __LZO_PTR_H
Packit Service 5195f2
#define __LZO_PTR_H 1
Packit Service 5195f2
Packit Service 5195f2
#ifdef __cplusplus
Packit Service 5195f2
extern "C" {
Packit Service 5195f2
#endif
Packit Service 5195f2
Packit Service 5195f2
Packit Service 5195f2
/***********************************************************************
Packit Service 5195f2
//
Packit Service 5195f2
************************************************************************/
Packit Service 5195f2
Packit Service 5195f2
/* Always use the safe (=integral) version for pointer-comparisons.
Packit Service 5195f2
 * The compiler should optimize away the additional casts anyway.
Packit Service 5195f2
 *
Packit Service 5195f2
 * Note that this only works if the representation and ordering
Packit Service 5195f2
 * of the pointer and the integral is the same (at bit level).
Packit Service 5195f2
 */
Packit Service 5195f2
Packit Service 5195f2
#if (LZO_ARCH_I086)
Packit Service 5195f2
#error "LZO_ARCH_I086 is unsupported"
Packit Service 5195f2
#elif (LZO_MM_PVP)
Packit Service 5195f2
#error "LZO_MM_PVP is unsupported"
Packit Service 5195f2
#else
Packit Service 5195f2
#define PTR(a)              ((lzo_uintptr_t) (a))
Packit Service 5195f2
#define PTR_LINEAR(a)       PTR(a)
Packit Service 5195f2
#define PTR_ALIGNED_4(a)    ((PTR_LINEAR(a) & 3) == 0)
Packit Service 5195f2
#define PTR_ALIGNED_8(a)    ((PTR_LINEAR(a) & 7) == 0)
Packit Service 5195f2
#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0)
Packit Service 5195f2
#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0)
Packit Service 5195f2
#endif
Packit Service 5195f2
Packit Service 5195f2
#define PTR_LT(a,b)         (PTR(a) < PTR(b))
Packit Service 5195f2
#define PTR_GE(a,b)         (PTR(a) >= PTR(b))
Packit Service 5195f2
#define PTR_DIFF(a,b)       (PTR(a) - PTR(b))
Packit Service 5195f2
#define pd(a,b)             ((lzo_uint) ((a)-(b)))
Packit Service 5195f2
Packit Service 5195f2
Packit Service 5195f2
LZO_EXTERN(lzo_uintptr_t)
Packit Service 5195f2
__lzo_ptr_linear(const lzo_voidp ptr);
Packit Service 5195f2
Packit Service 5195f2
Packit Service 5195f2
typedef union
Packit Service 5195f2
{
Packit Service 5195f2
    char            a_char;
Packit Service 5195f2
    unsigned char   a_uchar;
Packit Service 5195f2
    short           a_short;
Packit Service 5195f2
    unsigned short  a_ushort;
Packit Service 5195f2
    int             a_int;
Packit Service 5195f2
    unsigned int    a_uint;
Packit Service 5195f2
    long            a_long;
Packit Service 5195f2
    unsigned long   a_ulong;
Packit Service 5195f2
    lzo_int         a_lzo_int;
Packit Service 5195f2
    lzo_uint        a_lzo_uint;
Packit Service 5195f2
    lzo_xint        a_lzo_xint;
Packit Service 5195f2
    lzo_int16_t     a_lzo_int16_t;
Packit Service 5195f2
    lzo_uint16_t    a_lzo_uint16_t;
Packit Service 5195f2
    lzo_int32_t     a_lzo_int32_t;
Packit Service 5195f2
    lzo_uint32_t    a_lzo_uint32_t;
Packit Service 5195f2
#if defined(lzo_uint64_t)
Packit Service 5195f2
    lzo_int64_t     a_lzo_int64_t;
Packit Service 5195f2
    lzo_uint64_t    a_lzo_uint64_t;
Packit Service 5195f2
#endif
Packit Service 5195f2
    size_t          a_size_t;
Packit Service 5195f2
    ptrdiff_t       a_ptrdiff_t;
Packit Service 5195f2
    lzo_uintptr_t   a_lzo_uintptr_t;
Packit Service 5195f2
    void *          a_void_p;
Packit Service 5195f2
    char *          a_char_p;
Packit Service 5195f2
    unsigned char * a_uchar_p;
Packit Service 5195f2
    const void *          a_c_void_p;
Packit Service 5195f2
    const char *          a_c_char_p;
Packit Service 5195f2
    const unsigned char * a_c_uchar_p;
Packit Service 5195f2
    lzo_voidp       a_lzo_voidp;
Packit Service 5195f2
    lzo_bytep       a_lzo_bytep;
Packit Service 5195f2
    const lzo_voidp a_c_lzo_voidp;
Packit Service 5195f2
    const lzo_bytep a_c_lzo_bytep;
Packit Service 5195f2
}
Packit Service 5195f2
lzo_full_align_t;
Packit Service 5195f2
Packit Service 5195f2
Packit Service 5195f2
Packit Service 5195f2
#ifdef __cplusplus
Packit Service 5195f2
} /* extern "C" */
Packit Service 5195f2
#endif
Packit Service 5195f2
Packit Service 5195f2
#endif /* already included */
Packit Service 5195f2
Packit Service 5195f2
/*
Packit Service 5195f2
vi:ts=4:et
Packit Service 5195f2
*/
Packit Service 5195f2