Skip to content

Instantly share code, notes, and snippets.

@miura1729
miura1729 / mhash.c
Last active October 13, 2023 09:23
Can store 64000 data in 65536 buckets
#include "wyhash32.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int mh_key_t;
typedef int mh_value_t;
int pure;
@miura1729
miura1729 / mhash.c
Created September 30, 2023 08:22
Can store 8192 datas in 8192 buckets.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int mh_key_t;
typedef int mh_value_t;
typedef struct mhash {
uint64_t *exists;
@miura1729
miura1729 / mhash.c
Created September 28, 2023 09:10
Can large hash table
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int mh_key_t;
typedef int mh_value_t;
typedef struct mhash {
uint64_t *exists;
@miura1729
miura1729 / mhash.c
Created September 24, 2023 02:26
can 64 entry in 64bucket
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int key_t;
typedef int value_t;
typedef struct mhash {
uint64_t exists;
uint64_t origin;
@miura1729
miura1729 / mhash.c
Last active September 23, 2023 11:47
1st version 24 entry on 32 buckets
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef int key_t;
typedef int value_t;
typedef struct mhash {
uint64_t exists;
uint64_t origin;
def ast2str(node)
case node.type
when :SCOPE
tbl, args, body = node.children
"(#{tbl.map {|e| e.to_s}.join(" ,")}) \n #{ast2str(body)}"
when :ARGS
p node.children[1]
p node.children
"()"
main() {
printf("%d\n ", mod5(1));
printf("%d\n ", mod5(2));
printf("%d\n ", mod5(3));
printf("%d\n ", mod5(4));
printf("%d\n ", mod5(5));
printf("%d\n ", mod5(11));
printf("%d\n ", mod5(32));
printf("%d\n ", mod5(10));
printf("%d\n ", mod5(15));
@miura1729
miura1729 / gp.rb
Last active February 17, 2022 11:39
  graph TD
    N2[5]
    N1[ARRAY] --> |0| N2
    N3["foo"]
    N1[ARRAY] --> |1| N3
    N4[:a]
    N1[ARRAY] --> |2| N4
    N0[Foo] --> |"@a"| N1
 N0[Foo] --&gt; |"@b"| N0
Literal NilClass|
Literal FalseClass|Literal TrueClass|
Fixnum e=false pos =true|Float e=false pos =false|
String e=true l=8 var=0|
Array<[:undef] => Literal NilClass|[:undef] => Literal FalseClass|[:undef] => Literal TrueClass|
  [:undef] => Fixnum e=false pos =true|[:undef] => Float e=false pos =false|[:undef] => String e=true l=8 var=0|
 1 => Literal NilClass|1 => Literal FalseClass|1 => Literal TrueClass|1 => Fixnum e=false pos =true|
1 => Float e=false pos =false|1 => String e=true l=8 var=0> e=true l=8|Hash<[:undef] => NilClass e=false l=0 var=0|
[:undef] => Literal FalseClass|[:undef] => Literal TrueClass|[:undef] => Fixnum e=false pos =true|
[:undef] => Float e=false pos =false|[:undef] => String e=true l=8 var=0|
#include <mruby.h>
#include <mruby/value.h>
#include <mruby/array.h>
#include <mruby/hash.h>
#include <mruby/throw.h>
#include <mruby/proc.h>
#include <mruby/string.h>
#include <mruby/range.h>
#include <mruby/error.h>
#include <mruby/variable.h>