Skip to content

Commit

Permalink
phobos 0.154
Browse files Browse the repository at this point in the history
  • Loading branch information
braddr committed Sep 10, 2007
1 parent 164dc81 commit 91c29ea
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
15 changes: 8 additions & 7 deletions internal/aaA.d
Expand Up @@ -30,15 +30,16 @@ import std.string;
import std.outofmemory;

// Implementation of associative array
// Auto-rehash and pre-allocate - Dave Fladebo

static uint[] prime_list = [
97ul, 389ul,
1543ul, 6151ul,
24593ul, 98317ul,
393241ul, 1572869ul,
6291469ul, 25165843ul,
100663319ul, 402653189ul,
1610612741ul, 4294967291ul
97UL, 389UL,
1543UL, 6151UL,
24593UL, 98317UL,
393241UL, 1572869UL,
6291469UL, 25165843UL,
100663319UL, 402653189UL,
1610612741UL, 4294967291UL
];

struct Array
Expand Down
2 changes: 1 addition & 1 deletion internal/gc/gc.d
Expand Up @@ -528,7 +528,7 @@ size_t newCapacity(size_t newlength, size_t size)
else
{
/*
* Better version by davejf:
* Better version by Dave Fladebo:
* This uses an inverse logorithmic algorithm to pre-allocate a bit more
* space for larger arrays.
* - Arrays smaller than 4096 bytes are left as-is, so for the most
Expand Down
7 changes: 5 additions & 2 deletions internal/gc/gcx.d
@@ -1,5 +1,5 @@
//
// Copyright (C) 2001-2004 by Digital Mars
// Copyright (C) 2001-2006 by Digital Mars
// All Rights Reserved
// Written by Walter Bright
// www.digitalmars.com
Expand Down Expand Up @@ -216,7 +216,8 @@ class GC

if (std.thread.Thread.nthreads == 1)
{
/* The reason this works is because none of the gc code
/* Single-threaded no-sync - Dave Fladebo.
* The reason this works is because none of the gc code
* can start up a new thread from within mallocNoSync().
* Skip the sync for speed reasons.
*/
Expand All @@ -241,6 +242,7 @@ class GC
size += SENTINEL_EXTRA;

// Compute size bin
// Cache previous binsize lookup - Dave Fladebo.
static size_t lastsize = -1;
static Bins lastbin;
if (size == lastsize)
Expand Down Expand Up @@ -289,6 +291,7 @@ class GC
// Return next item from free list
gcx.bucket[bin] = (cast(List *)p).next;
//memset(p + size, 0, binsize[bin] - size);
// 'inline' memset - Dave Fladebo.
foreach(inout byte b; cast(byte[])(p + size)[0..binsize[bin] - size]) { b = 0; }
//debug(PRINTF) printf("\tmalloc => %x\n", p);
debug (MEMSTOMP) memset(p, 0xF0, size);
Expand Down
4 changes: 2 additions & 2 deletions std/file.d
Expand Up @@ -458,7 +458,7 @@ Lerr:
struct DirEntry
{
char[] name; /// file or directory name
ulong size = ~0ul; /// size of file in bytes
ulong size = ~0UL; /// size of file in bytes
d_time creationTime = d_time_nan; /// time of file creation
d_time lastAccessTime = d_time_nan; /// time file was last accessed
d_time lastWriteTime = d_time_nan; /// time file was last written to
Expand Down Expand Up @@ -1153,7 +1153,7 @@ char[] getcwd()
struct DirEntry
{
char[] name; /// file or directory name
ulong _size = ~0ul; // size of file in bytes
ulong _size = ~0UL; // size of file in bytes
d_time _creationTime = d_time_nan; // time of file creation
d_time _lastAccessTime = d_time_nan; // time file was last accessed
d_time _lastWriteTime = d_time_nan; // time file was last written to
Expand Down
1 change: 1 addition & 0 deletions std/stream.d
Expand Up @@ -1613,6 +1613,7 @@ class BufferedStream : FilterStream {
return streamPos-bufferSourcePos+bufferCurPos;
}

// Buffered readLine - Dave Fladebo
// reads a line, terminated by either CR, LF, CR/LF, or EOF
// reusing the memory in buffer if result will fit, otherwise
// will reallocate (using concatenation)
Expand Down
18 changes: 9 additions & 9 deletions std/string.d
Expand Up @@ -2311,15 +2311,15 @@ unittest
char[] r;
int i;

r = toString(0ul);
r = toString(0uL);
i = cmp(r, "0");
assert(i == 0);

r = toString(9ul);
r = toString(9uL);
i = cmp(r, "9");
assert(i == 0);

r = toString(123ul);
r = toString(123uL);
i = cmp(r, "123");
assert(i == 0);
}
Expand Down Expand Up @@ -2416,27 +2416,27 @@ unittest
char[] r;
int i;

r = toString(0l);
r = toString(0L);
i = cmp(r, "0");
assert(i == 0);

r = toString(9l);
r = toString(9L);
i = cmp(r, "9");
assert(i == 0);

r = toString(123l);
r = toString(123L);
i = cmp(r, "123");
assert(i == 0);

r = toString(-0l);
r = toString(-0L);
i = cmp(r, "0");
assert(i == 0);

r = toString(-9l);
r = toString(-9L);
i = cmp(r, "-9");
assert(i == 0);

r = toString(-123l);
r = toString(-123L);
i = cmp(r, "-123");
assert(i == 0);
}
Expand Down

0 comments on commit 91c29ea

Please sign in to comment.