Sha256: 6ed6a3f55da7c18ab9a562c377e58aed52b373b92beac2668d07410f023ce2ba

Contents?: true

Size: 1.32 KB

Versions: 101

Compression:

Stored size: 1.32 KB

Contents

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

#include <sys/types.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>

typedef int8_t s8;
typedef uint8_t u8;
typedef int16_t s16;
typedef uint16_t u16;
typedef int32_t s32;
typedef uint32_t u32;
typedef int64_t s64;
typedef uint64_t u64;
typedef signed long sL;
typedef unsigned long uL;
typedef float F;
typedef double D;

void pack_varargs(s64* buf, const char* fmt, ...)
{
    va_list ap;
    int c;
    double d;
    va_start(ap, fmt);
    while ((c = *fmt++)) {
        switch (c) {
            case 'c':
            case 's':
            case 'i':
                *buf++ = va_arg(ap, s32);
                break;
            case 'l':
                *buf++ = va_arg(ap, long);
                break;
            case 'j':
                *buf++ = va_arg(ap, s64);
                break;
            case 'f':
            case 'd':
                d = va_arg(ap, double);
                memcpy(buf++, &d, sizeof(d));
                break;
            case 'C':
            case 'S':
            case 'I':
                *buf++ = va_arg(ap, u32);
                break;
            case 'L':
                *buf++ = va_arg(ap, unsigned long);
                break;
        }
    }
    va_end(ap);
}

Version data entries

101 entries across 80 versions & 16 rubygems

Version Path
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/ffi-1.9.10/libtest/VariadicTest.c
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
tdiary-5.0.1 vendor/bundle/gems/ffi-1.9.10/libtest/VariadicTest.c
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.10/libtest/VariadicTest.c
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.11 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.11 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.11 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.10 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.10 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.10 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.9 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.9 vendor/gems/ruby/2.2.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.9 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.8 vendor/gems/ruby/2.0.0/gems/ffi-1.9.10/libtest/VariadicTest.c
yakg-0.1.8 vendor/gems/ruby/2.1.0/gems/ffi-1.9.10/libtest/VariadicTest.c