Sha256: 75a08a6f965df03c16c406df4dc8c4830bdd95f1917a02b9a84659602cfd7cd8

Contents?: true

Size: 1.63 KB

Versions: 149

Compression:

Stored size: 1.63 KB

Contents

/*
 * Copyright (c) 2008, 2009, Wayne Meissner
 *
 * All rights reserved.
 *
 * This file is part of ruby-ffi.
 *
 * This code is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License version 3 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * version 3 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with this work.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef RBFFI_COMPAT_H
#define RBFFI_COMPAT_H

#include <ruby.h>

#ifndef RARRAY_LEN
#  define RARRAY_LEN(ary) RARRAY(ary)->len
#endif

#ifndef RARRAY_PTR
#  define RARRAY_PTR(ary) RARRAY(ary)->ptr
#endif

#ifndef RSTRING_LEN
#  define RSTRING_LEN(s) RSTRING(s)->len
#endif

#ifndef RSTRING_PTR
#  define RSTRING_PTR(s) RSTRING(s)->ptr
#endif

#ifndef NUM2ULL
#  define NUM2ULL(x) rb_num2ull((VALUE)x)
#endif

#ifndef roundup
#  define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
#endif

#ifdef __GNUC__
#  define likely(x) __builtin_expect((x), 1)
#  define unlikely(x) __builtin_expect((x), 0)
#else
#  define likely(x) (x)
#  define unlikely(x) (x)
#endif

#ifndef MAX
#  define MAX(a, b) ((a) < (b) ? (b) : (a))
#endif
#ifndef MIN
#  define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif

#ifndef RB_GC_GUARD
#  define RB_GC_GUARD(x) (x)
#endif

#ifndef RB_GC_GUARD_PTR
#  define RB_GC_GUARD_PTR(x) (x)
#endif

#endif /* RBFFI_COMPAT_H */

Version data entries

149 entries across 149 versions & 13 rubygems

Version Path
classiccms-0.6.1 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
classiccms-0.6.0 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
classiccms-0.5.17 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
classiccms-0.5.16 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
ffi-1.1.5-x86-mingw32 ext/ffi_c/compat.h
ffi-1.1.6.pre2-x86-mingw32 ext/ffi_c/compat.h
ffi-1.1.6.pre2 ext/ffi_c/compat.h
ffi-1.2.0.pre1 ext/ffi_c/compat.h
classiccms-0.5.15 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
classiccms-0.5.14 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
classiccms-0.5.13 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/ffi-1.1.5/ext/ffi_c/compat.h
classiccms-0.5.12 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
classiccms-0.5.11 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
ffi-1.1.6.pre1 ext/ffi_c/compat.h
ffi-1.2.0.dev4 ext/ffi_c/compat.h
classiccms-0.5.10 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
classiccms-0.5.9 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h
ffi-1.2.0.dev3 ext/ffi_c/compat.h
classiccms-0.5.8 vendor/bundle/gems/ffi-1.0.11/ext/ffi_c/compat.h