From: ori@eigenstate.org
To: 9front@9front.org
Subject: Re: [9front] make arrays big: qsort edition
Date: Tue, 03 Aug 2021 00:11:08 -0400 [thread overview]
Message-ID: <82FC95C9FC70B1C0C9E6C73E07797849@eigenstate.org> (raw)
In-Reply-To: <92B827BDFC2D678CA23B1000DEE041AF@felloff.net>
Quoth cinap_lenrek@felloff.net:
> sbrk() has been fixed to take usize now,
> so you can just do: buf = sbrk(LARGE);
Ah, good to know!
Anyways, updated so we can build the kernel:
if there are no objections, will commit in the
next day or two.
--- /mnt/git/object/7f832df53d2a1d45fb7c7b2129e56b6b9e855682/tree/sys/include/libc.h
+++ sys/include/libc.h
@@ -424,7 +424,7 @@
extern int postnote(int, int, char *);
extern double pow10(int);
extern int putenv(char*, char*);
-extern void qsort(void*, long, long, int (*)(void*, void*));
+extern void qsort(void*, usize, usize, int (*)(void*, void*));
extern int setjmp(jmp_buf);
extern double strtod(char*, char**);
extern long strtol(char*, char**, int);
--- /mnt/git/object/7f832df53d2a1d45fb7c7b2129e56b6b9e855682/tree/sys/src/9/port/lib.h
+++ sys/src/9/port/lib.h
@@ -158,7 +158,7 @@
extern int dec64(uchar*, int, char*, int);
extern int dec16(uchar*, int, char*, int);
extern int encodefmt(Fmt*);
-extern void qsort(void*, long, long, int (*)(void*, void*));
+extern void qsort(void*, usize, usize, int (*)(void*, void*));
/*
* Syscall data structures
--- /mnt/git/object/7f832df53d2a1d45fb7c7b2129e56b6b9e855682/tree/sys/src/libc/port/qsort.c
+++ sys/src/libc/port/qsort.c
@@ -8,12 +8,12 @@
struct
{
int (*cmp)(void*, void*);
- void (*swap)(char*, char*, long);
- long es;
+ void (*swap)(char*, char*, usize);
+ usize es;
} Sort;
static void
-swapb(char *i, char *j, long es)
+swapb(char *i, char *j, usize es)
{
char c;
@@ -27,7 +27,7 @@
}
static void
-swapi(char *ii, char *ij, long es)
+swapi(char *ii, char *ij, usize es)
{
long *i, *j, c;
@@ -42,9 +42,9 @@
}
static char*
-pivot(char *a, long n, Sort *p)
+pivot(char *a, usize n, Sort *p)
{
- long j;
+ usize j;
char *pi, *pj, *pk;
j = n/6 * p->es;
@@ -69,9 +69,9 @@
}
static void
-qsorts(char *a, long n, Sort *p)
+qsorts(char *a, usize n, Sort *p)
{
- long j, es;
+ usize j, es;
char *pi, *pj, *pn;
es = p->es;
@@ -111,7 +111,7 @@
}
void
-qsort(void *va, long n, long es, int (*cmp)(void*, void*))
+qsort(void *va, usize n, usize es, int (*cmp)(void*, void*))
{
Sort s;
prev parent reply other threads:[~2021-08-03 9:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 17:14 ori
2021-07-29 23:15 ` Nick Owens
2021-07-30 17:24 ` Steve Simon
2021-08-01 23:53 ` ori
2021-08-02 16:14 ` cinap_lenrek
2021-08-03 4:11 ` ori [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82FC95C9FC70B1C0C9E6C73E07797849@eigenstate.org \
--to=ori@eigenstate.org \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).