aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--include/libn/macro/map.h12
-rw-r--r--include/libn/macro/qsort.h3
-rw-r--r--rules.mk8
-rw-r--r--sys/libbio/simulate.c1
-rw-r--r--sys/libn/rules.mk4
-rw-r--r--sys/libn/test.c50
7 files changed, 14 insertions, 66 deletions
diff --git a/Makefile b/Makefile
index e09510d..0861986 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ CINIT := $(LIB_DIR)/crt/crt1.o $(LIB_DIR)/crt/x86_64/crti.o `gcc --print-file-na
CFINI := `gcc --print-file-name=crtendS.o` $(LIB_DIR)/crt/x86_64/crtn.o
# Flags, Libraries and Includes
-CFLAGS := -g -O3 -march=native \
+CFLAGS := -g -march=native \
-ffast-math -fno-strict-aliasing -fwrapv -fms-extensions \
-Wno-microsoft-anon-tag -Wno-incompatible-function-pointer-types
STATIC := -static -nodefaultlibs -nostartfiles
diff --git a/include/libn/macro/map.h b/include/libn/macro/map.h
index 2e65570..37b7dfd 100644
--- a/include/libn/macro/map.h
+++ b/include/libn/macro/map.h
@@ -223,15 +223,3 @@ static const double __ac_HASH_UPPER = 0.77;
--map->size; \
} \
}
-
-static int32 hash_string(byte *s) {
- int32 h;
- byte *it;
-
- h = (int32)(*s);
- if (h != 0) {
- for (it = s; *it; ++it)
- h = (h << 5) - h + (int32)*it;
- }
- return h;
-}
diff --git a/include/libn/macro/qsort.h b/include/libn/macro/qsort.h
index cc38bca..2ff964a 100644
--- a/include/libn/macro/qsort.h
+++ b/include/libn/macro/qsort.h
@@ -1,12 +1,15 @@
#pragma once
/*
+ * Nicholas Noll (2020)
* Straight implementation of Sedgewick's median qsort
+ * #ref: "Implementing Quicksort Programs" (1978)
*
* @LEN: name of parameter length
* @QLESS: name of function that computes array[i] < array[j]
* should return a boolean
* @QSWAP: name of function that swaps array[i] <-> array[j]
+ * this could swap multiple arrays
*
* NOTE: This can perform on strided arrays.
* Make sure to use parens liberally to ensure hygeine!
diff --git a/rules.mk b/rules.mk
index 3f2de37..7fc6a1f 100644
--- a/rules.mk
+++ b/rules.mk
@@ -1,10 +1,16 @@
# Standard housekeeping
-.PHONY: all clean install
+.PHONY: all debug release clean install
.SUFFIXES:
.SUFFIXES: .s .c .o
all: targets
+debug: CFLAGS += -DDEBUG
+debug: targets
+
+release: CFLAGS += -DNDEBUG -O3
+release: targets
+
# Targets & array of sources & intermediates
SRCS :=
OBJS :=
diff --git a/sys/libbio/simulate.c b/sys/libbio/simulate.c
index a4567d5..f5489b6 100644
--- a/sys/libbio/simulate.c
+++ b/sys/libbio/simulate.c
@@ -73,6 +73,7 @@ main()
int *loc[aln·N];
uint64 vals[aln·N][NSEQS][aln·L];
uint64 *val[aln·N];
+
rng·init(0);
seqs[0] = SEQ;
diff --git a/sys/libn/rules.mk b/sys/libn/rules.mk
index ffb41e4..19e4c50 100644
--- a/sys/libn/rules.mk
+++ b/sys/libn/rules.mk
@@ -24,7 +24,7 @@ LIBS_$(d) := $(d)/libn.a
LIBS_$(d) := $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(LIBS_$(d)))
LIBS := $(LIBS) $(LIBS_$(d))
-BINS_$(d) := $(d)/test $(d)/scratch
+BINS_$(d) := $(d)/test
BINS_$(d) := $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(BINS_$(d)))
BINS := $(BINS) $(BINS_$(d))
@@ -37,7 +37,7 @@ $(LIBS_$(d)): $(OBJS_$(d))
$(ARCHIVE)
$(BINS_$(d)): TCLIBS := $(LIBS_$(d)) $(LIB_DIR)/vendor/libz.a
-$(BINS_$(d)): $(OBJ_DIR)/libn/scratch.o
+$(BINS_$(d)): $(OBJ_DIR)/libn/test.o
$(LINK)
# ---- Pop off stack ----
diff --git a/sys/libn/test.c b/sys/libn/test.c
index 973245f..b52207d 100644
--- a/sys/libn/test.c
+++ b/sys/libn/test.c
@@ -155,56 +155,6 @@ test·sort()
return 0;
}
-#define HASH(str) hash_string(str)
-#define EQUAL(str, str2) (str == str2)
-
-typedef struct Map
-{
- MAP_STRUCT_BODY(byte*, float)
-} Map;
-
-Map*
-makemap(mem·Allocator heap, void* h)
-{
- MAP_MAKE(Map);
-}
-
-void
-mapfree(Map *map)
-{
- MAP_FREE(map);
-}
-
-void
-mapreset(Map *map)
-{
- MAP_RESET(map);
-}
-
-double
-mapget(Map *map, byte *key)
-{
- MAP_GET(map, key, HASH, EQUAL);
-}
-
-static
-error
-mapresize(Map *map, int n)
-{
- MAP_GROW(map, byte*, float, n, HASH);
-}
-
-static
-int
-mapput(Map *map, byte *key, float val, error *err)
-{
- MAP_PUT(map, key, val, HASH, EQUAL, mapresize, err);
-}
-
-
-#undef HASH
-#undef EQUAL
-
error
main()
{