id_shuffler 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/id_shuffler/id_shuffler.c +5 -0
- data/lib/id_shuffler.rb +0 -4
- metadata +1 -1
@@ -68,6 +68,10 @@ uint32_t g(char key[10], int k, uint32_t w)
|
|
68
68
|
return (((g5<<8) + g6) & 32767); /* clip result to 15 bits */
|
69
69
|
}
|
70
70
|
|
71
|
+
static VALUE r_is_big_endian(VALUE self) {
|
72
|
+
return ULONG2NUM(is_bigendian());
|
73
|
+
}
|
74
|
+
|
71
75
|
static VALUE r_g1(VALUE self) {
|
72
76
|
char key[10] = {1,2,3,4,5,6,7,8,9,10};
|
73
77
|
return ULONG2NUM(g(key,1,1));
|
@@ -245,6 +249,7 @@ void Init_id_shuffler(void) {
|
|
245
249
|
VALUE klass = rb_define_class("IdShuffler", rb_cObject);
|
246
250
|
rb_define_singleton_method(klass, "shuffle_with_raw_key", r_base32_shuffle, 2);
|
247
251
|
rb_define_singleton_method(klass, "unshuffle_with_raw_key", r_base32_unshuffle, 2);
|
252
|
+
rb_define_singleton_method(klass, "is_bigendian", r_is_big_endian,0);
|
248
253
|
rb_define_singleton_method(klass, "g1", r_g1,0);
|
249
254
|
rb_define_singleton_method(klass, "g2", r_g2,0);
|
250
255
|
rb_define_singleton_method(klass, "skip1", r_skip1,0);
|
data/lib/id_shuffler.rb
CHANGED