Exemplo n.º 1
0
        unsafe public VALUE MySum2(int argc, VALUE *NumArray, VALUE self)
        {
            int nType  = 0;
            int nStart = 0;
            int nEnd   = 0;
            int nSum   = 0;

            nStart = (int)Script.rb_num2int(NumArray[0]);
            nEnd   = (int)Script.rb_num2int(NumArray[1]);
            //nEnd = Script.rb_num2int(NumArray[1]);

            if (nStart <= nEnd)
            {
                for (int nIndex = nStart; nIndex <= nEnd; nIndex++)
                {
                    nSum += nIndex;
                }
            }
            else
            {
                for (int nIndex = nEnd; nIndex <= nStart; nIndex++)
                {
                    nSum += nIndex;
                }
            }

            return(Script.rb_int2inum(nSum));
        }
 public NativeStack(int capacity, Allocator allocator)
 {
     _sizeOfValue   = UnsafeUtility.SizeOf <VALUE>();
     _alignOfValue  = UnsafeUtility.AlignOf <VALUE>();
     _allocator     = allocator;
     _capacity      = capacity;
     _buffer        = (VALUE *)UnsafeUtility.Malloc(_sizeOfValue * _capacity, _alignOfValue, _allocator);
     _lastItemIndex = -1;
 }
 public void Dispose()
 {
     UnsafeUtility.Free(_buffer, _allocator);
     _buffer        = null;
     _lastItemIndex = -1;
 }
Exemplo n.º 4
0
 public static extern VALUE rb_ary_aref(int argc, VALUE *argv, VALUE ary);
Exemplo n.º 5
0
 public static extern VALUE rb_ary_cat(VALUE ary, VALUE *argv, int argc);
Exemplo n.º 6
0
 public static VALUE rb_ary_new(int argc, VALUE *argv) => rb_ary_new_from_values(argc, argv);
Exemplo n.º 7
0
 private static extern VALUE rb_ary_new_from_values(int length, VALUE *args);
Exemplo n.º 8
0
 private static extern IntPtr rb_string_value_cstr(VALUE *str);