-428460ddd8087fa28815e613ff04facb51108a7b
+b538f758a4d274b64751f80564b0207845cd018c
The first line of this file holds the git revision number of the last
merge done from the dlang/phobos repository.
}
catch (Throwable e)
{
- import core.stdc.stdlib : exit, EXIT_FAILURE;
- stderr.writeln(e);
- exit(EXIT_FAILURE); // Bugzilla 7018
+ stderr.writeln(e); // Bugzilla 7018
}
}
}
{
OutBuffer buf = new OutBuffer();
"hello"w.copy(buf);
- assert(buf.toBytes() == "h\x00e\x00l\x00l\x00o\x00");
+ version (LittleEndian)
+ assert(buf.toBytes() == "h\x00e\x00l\x00l\x00o\x00");
+ version (BigEndian)
+ assert(buf.toBytes() == "\x00h\x00e\x00l\x00l\x00o");
}
{
OutBuffer buf = new OutBuffer();
"hello"d.copy(buf);
- assert(buf.toBytes() == "h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00");
+ version (LittleEndian)
+ assert(buf.toBytes() == "h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00");
+ version (BigEndian)
+ assert(buf.toBytes() == "\x00\x00\x00h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o");
}
}
enum hasUnalignedReads = true;
else version (X86_64)
enum hasUnalignedReads = true;
+else version (SystemZ)
+ enum hasUnalignedReads = true;
else
enum hasUnalignedReads = false; // better be safe then sorry
T opIndex(size_t idx) inout
{
- return __ctfe ? simpleIndex(idx) :
- cast(inout(T))(cast(U*) origin)[idx];
+ T ret;
+ version (LittleEndian)
+ ret = __ctfe ? simpleIndex(idx) :
+ cast(inout(T))(cast(U*) origin)[idx];
+ else
+ ret = simpleIndex(idx);
+ return ret;
}
static if (isBitPacked!T) // lack of user-defined implicit conversion
void opIndexAssign(TypeOfBitPacked!T val, size_t idx)
{
- if (__ctfe)
- simpleWrite(val, idx);
+ version (LittleEndian)
+ {
+ if (__ctfe)
+ simpleWrite(val, idx);
+ else
+ (cast(U*) origin)[idx] = cast(U) val;
+ }
else
- (cast(U*) origin)[idx] = cast(U) val;
+ simpleWrite(val, idx);
}
}
else
mixin Check!("Chars");
dchar c;
- int n = -1;
- foreach (int i,dchar d; s)
+ ptrdiff_t n = -1;
+ // 'i' must not be smaller than size_t because size_t is used internally in
+ // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets.
+ foreach (size_t i, dchar d; s)
{
if (!isChar(d))
{
mixin Check!("Name");
if (s.length == 0) fail();
- int n;
- foreach (int i,dchar c;s)
+ ptrdiff_t n;
+ // 'i' must not be smaller than size_t because size_t is used internally in
+ // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets.
+ foreach (size_t i, dchar c; s)
{
if (c == '_' || c == ':' || isLetter(c)) continue;
if (i == 0) fail();