data_structures_rmolinari 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -4
  3. data/ext/cc.h +3879 -0
  4. data/ext/shared.h +33 -0
  5. metadata +3 -1
data/ext/shared.h ADDED
@@ -0,0 +1,33 @@
1
+ #ifndef SHARED_H
2
+ #define SHARED_H
3
+
4
+ #include <stddef.h>
5
+ #include "ruby.h"
6
+
7
+ #define mShared rb_define_module("Shared")
8
+ #define eSharedDataError rb_const_get(mShared, rb_intern_const("DataError"))
9
+ #define eSharedInternalLogicError rb_const_get(mShared, rb_intern_const("InternalLogicError"))
10
+ #define mDataStructuresRMolinari rb_define_module("DataStructuresRMolinari")
11
+
12
+ //#define debug(...) printf(__VA_ARGS__)
13
+ #define debug(...)
14
+
15
+ /* What we might think of as vector[index]. It is assignable */
16
+ #define lval(vector, index) (*get(vector, index))
17
+
18
+ /*
19
+ * Binary tree arithmetic for an implicit tree in an array, 1-based.
20
+ *
21
+ * TODO: into shared header
22
+ */
23
+ #define TREE_ROOT 1
24
+ size_t midpoint(size_t left, size_t right);
25
+ size_t left_child(size_t i);
26
+ size_t right_child(size_t i);
27
+
28
+ /*
29
+ * Check that a Ruby value is a non-negative Fixnum and convert it to a C unsigned long
30
+ */
31
+ unsigned long checked_nonneg_fixnum(VALUE val);
32
+
33
+ #endif
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_structures_rmolinari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rory Molinari
@@ -89,7 +89,9 @@ files:
89
89
  - ext/c_disjoint_union/extconf.rb
90
90
  - ext/c_segment_tree_template/extconf.rb
91
91
  - ext/c_segment_tree_template/segment_tree_template.c
92
+ - ext/cc.h
92
93
  - ext/shared.c
94
+ - ext/shared.h
93
95
  - lib/data_structures_rmolinari.rb
94
96
  - lib/data_structures_rmolinari/algorithms.rb
95
97
  - lib/data_structures_rmolinari/c_segment_tree_template_impl.rb