Sha256: 69299924500152fe29b504b6069f480597e690febc4ba536679268d4a86b332b

Contents?: true

Size: 955 Bytes

Versions: 8

Compression:

Stored size: 955 Bytes

Contents

/**
** @file mruby/istruct.h - Inline structures
**
** See Copyright Notice in mruby.h
*/

#ifndef MRUBY_ISTRUCT_H
#define MRUBY_ISTRUCT_H

#include "common.h"
#include <string.h>

/**
 * Inline structures that fit in RVALUE
 *
 * They cannot have finalizer, and cannot have instance variables.
 */
MRB_BEGIN_DECL

#define ISTRUCT_DATA_SIZE (sizeof(void*) * 3)

struct RIStruct {
  MRB_OBJECT_HEADER;
  union {
    intptr_t inline_alignment[3];
    char inline_data[ISTRUCT_DATA_SIZE];
  };
};

#define RISTRUCT(obj)         ((struct RIStruct*)(mrb_ptr(obj)))
#define ISTRUCT_PTR(obj)      (RISTRUCT(obj)->inline_data)

MRB_INLINE mrb_int mrb_istruct_size()
{
  return ISTRUCT_DATA_SIZE;
}

MRB_INLINE void* mrb_istruct_ptr(mrb_value object)
{
  return ISTRUCT_PTR(object);
}

MRB_INLINE void mrb_istruct_copy(mrb_value dest, mrb_value src)
{
  memcpy(ISTRUCT_PTR(dest), ISTRUCT_PTR(src), ISTRUCT_DATA_SIZE);
}

MRB_END_DECL

#endif /* MRUBY_ISTRUCT_H */

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ruby2d-0.12.1 assets/include/mruby/istruct.h
ruby2d-0.12.0 assets/include/mruby/istruct.h
ruby2d-0.11.3 assets/include/mruby/istruct.h
ruby2d-0.11.2 assets/include/mruby/istruct.h
script_core-0.3.2 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.3.0 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.2.7 ext/enterprise_script_service/mruby/include/mruby/istruct.h
script_core-0.2.6 ext/enterprise_script_service/mruby/include/mruby/istruct.h