Sha256: d349d78044e3da7681dc8939876b4e505e890a29e6d72e199e7b918bd470bea6

Contents?: true

Size: 802 Bytes

Versions: 234

Compression:

Stored size: 802 Bytes

Contents

/*
 * Copyright (c) 2007 Wayne Meissner. All rights reserved.
 *
 * For licensing, see LICENSE.SPECS
 */

#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>

typedef char s8;
typedef short s16;
typedef int s32;
typedef long long s64;
typedef float f32;
typedef double f64;

typedef union union_test {
    char b;
    short s;
    int i;
    long long j;
    long l;
    float f;
    double d;
    s8 a[10];
} union_test_t;

#define T(x, type) \
  type union_align_##type(union_test_t* u) { return u->x; } \
  union_test_t* union_make_union_with_##type(type value) { static union_test_t u; u.x = value; return &u; }

T(b, s8);
T(s, s16);
T(i, s32);
T(j, s64);
T(f, f32);
T(d, f64);
T(l, long);

unsigned int union_size() { return sizeof(union_test_t); }

Version data entries

234 entries across 129 versions & 21 rubygems

Version Path
yakg-0.1.5 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c
yakg-0.1.3 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/UnionTest.c
yakg-0.1.3 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c
yakg-0.1.3 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/UnionTest.c
yakg-0.0.11 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/UnionTest.c
yakg-0.0.11 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/UnionTest.c
yakg-0.0.11 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/spec/ffi/fixtures/UnionTest.c
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/spec/ffi/fixtures/UnionTest.c
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/spec/ffi/fixtures/UnionTest.c
vagrant-cloudstack-1.2.0 vendor/bundle/gems/ffi-1.9.10-x86-mingw32/libtest/UnionTest.c
vagrant-cloudstack-1.2.0 vendor/bundle/gems/ffi-1.9.10-x86-mingw32/spec/ffi/fixtures/UnionTest.c
geminfo-0.1.0 path/gems/ffi-1.9.10-x86-mingw32/libtest/UnionTest.c
geminfo-0.1.0 path/gems/ffi-1.9.10-x86-mingw32/spec/ffi/fixtures/UnionTest.c
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/ffi-1.9.10/spec/ffi/fixtures/UnionTest.c
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/UnionTest.c
ffi-1.9.10-x64-mingw32 spec/ffi/fixtures/UnionTest.c