Browse Source

Plan 9 from Bell Labs 2013-01-24

David du Colombier 6 years ago
parent
commit
e8406a2f44
3 changed files with 569 additions and 366 deletions
  1. 0 2
      sys/src/9/bitsy/etherif.h
  2. 9 0
      sys/src/9/bitsy/mem.h
  3. 560 364
      sys/src/9/ip/tcp.c

+ 0 - 2
sys/src/9/bitsy/etherif.h

@@ -35,5 +35,3 @@ extern ulong ethercrc(uchar*, int);
 
 #define NEXT(x, l)	(((x)+1)%(l))
 #define PREV(x, l)	(((x) == 0) ? (l)-1: (x)-1)
-#define	HOWMANY(x, y)	(((x)+((y)-1))/(y))
-#define ROUNDUP(x, y)	(HOWMANY((x), (y))*(y))

+ 9 - 0
sys/src/9/bitsy/mem.h

@@ -1,6 +1,15 @@
 /*
  * Memory and machine-specific definitions.  Used in C and assembler.
  */
+#define KiB		1024u			/* Kibi 0x0000000000000400 */
+#define MiB		1048576u		/* Mebi 0x0000000000100000 */
+#define GiB		1073741824u		/* Gibi 000000000040000000 */
+
+#define HOWMANY(x, y)	(((x)+((y)-1))/(y))
+#define ROUNDUP(x, y)	(HOWMANY((x), (y))*(y))	/* ceiling */
+#define ROUNDDN(x, y)	(((x)/(y))*(y))		/* floor */
+#define MIN(a, b)	((a) < (b)? (a): (b))
+#define MAX(a, b)	((a) > (b)? (a): (b))
 
 /*
  * Sizes

File diff suppressed because it is too large
+ 560 - 364
sys/src/9/ip/tcp.c