Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
November 30, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
The compiler is passing the test suite now, the only failure is in the unit tests of std.bigint. Anyhow, any brave souls who want to try it out should have a go! |
November 30, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 30 November 2011 09:27, Walter Bright <walter at digitalmars.com> wrote: > The compiler is passing the test suite now, the only failure is in the unit tests of std.bigint. Anyhow, any brave souls who want to try it out should have a go! If anyone tries it, please help me fix the bigint failure by telling me the result of: import std.bigint; import std.stdio; string toHex(BigInt x) { string outbuff=""; void sink(const(char)[] s) { outbuff ~= s; } x.toString(&sink, "%x"); return outbuff; } void main() { writeln(toHex(BigInt("0x1234567890123456789"))); } > _______________________________________________ > dmd-internals mailing list > dmd-internals at puremagic.com > http://lists.puremagic.com/mailman/listinfo/dmd-internals > |
November 30, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | On 30 November 2011 09:30, Don Clugston <dclugston at googlemail.com> wrote: > On 30 November 2011 09:27, Walter Bright <walter at digitalmars.com> wrote: > > The compiler is passing the test suite now, the only failure is in the > unit > > tests of std.bigint. Anyhow, any brave souls who want to try it out > should > > have a go! > > If anyone tries it, please help me fix the bigint failure by telling me the result of: > > import std.bigint; > import std.stdio; > > string toHex(BigInt x) > { > string outbuff=""; > void sink(const(char)[] s) { outbuff ~= s; } > x.toString(&sink, "%x"); > return outbuff; > } > > void main() > { > writeln(toHex(BigInt("0x1234567890123456789"))); > } > 44444567_89ABCD45_6789ABCD -- Robert http://octarineparrot.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.puremagic.com/pipermail/dmd-internals/attachments/20111130/c7a77d9e/attachment.html> |
November 30, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | On 11/30/2011 1:30 AM, Don Clugston wrote: > On 30 November 2011 09:27, Walter Bright<walter at digitalmars.com> wrote: >> The compiler is passing the test suite now, the only failure is in the unit tests of std.bigint. Anyhow, any brave souls who want to try it out should have a go! > If anyone tries it, please help me fix the bigint failure by telling me the result of: osx ~/cbx/mars> cat foo.d import std.bigint; import std.stdio; string toHex(BigInt x) { string outbuff=""; void sink(const(char)[] s) { outbuff ~= s; } x.toString(&sink, "%x"); return outbuff; } void main() { writeln(toHex(BigInt("0x1234567890123456789"))); } osx ~/cbx/mars> ./dmd foo -m32 osx ~/cbx/mars> ./foo 123_45678901_23456789 osx ~/cbx/mars> ./dmd foo -m64 osx ~/cbx/mars> ./foo 44444567_89ABCD45_6789ABCD osx ~/cbx/mars> |
December 01, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 30 November 2011 23:18, Walter Bright <walter at digitalmars.com> wrote:
>
>
> On 11/30/2011 1:30 AM, Don Clugston wrote:
>>
>> On 30 November 2011 09:27, Walter Bright<walter at digitalmars.com> ?wrote:
>>>
>>> The compiler is passing the test suite now, the only failure is in the
>>> unit
>>> tests of std.bigint. Anyhow, any brave souls who want to try it out
>>> should
>>> have a go!
>>
>> If anyone tries it, please help me fix the bigint failure by telling me the result of:
>
>
> osx ~/cbx/mars> cat foo.d
>
> import std.bigint;
> import std.stdio;
>
> string toHex(BigInt x)
> {
> ? ?string outbuff="";
> ? ?void sink(const(char)[] s) { outbuff ~= s; }
> ? ?x.toString(&sink, "%x");
> ? ?return outbuff;
> }
>
> void main()
> {
> ? writeln(toHex(BigInt("0x1234567890123456789")));
> }
>
> osx ~/cbx/mars> ./dmd foo -m32
> osx ~/cbx/mars> ./foo
> 123_45678901_23456789
> osx ~/cbx/mars> ./dmd foo -m64
> osx ~/cbx/mars> ./foo
> 44444567_89ABCD45_6789ABCD
The hex digits are 4 higher than they should be, in every case.
'0'-> '4', '2'->'6', '9' -> 'D', etc.
The hex digits are set in this function:
void toHexZeroPadded(char[] output, uint value)
{
ptrdiff_t x = output.length - 1;
static immutable string hexDigits = "0123456789ABCDEF";
for( ; x>=0; --x)
{
output[x] = hexDigits[value & 0xF];
value >>= 4;
}
}
This really looks as though hexDigits is the wrong address. Maybe
because it's a local static variable.
I predict that a minimal test case would be:
void foo(uint value)
{
static immutable string hexDigits = "0123456789ABCDEF";
assert( hexDigits[value & 0xF] == '0');
}
void main()
{
foo(0);
}
|
December 01, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston |
On 12/1/2011 12:45 AM, Don Clugston wrote:
>
> This really looks as though hexDigits is the wrong address. Maybe
> because it's a local static variable.
> I predict that a minimal test case would be:
>
> void foo(uint value)
> {
> static immutable string hexDigits = "0123456789ABCDEF";
> assert( hexDigits[value& 0xF] == '0');
> }
> void main()
> {
> foo(0);
> }
>
Sadly, it works.
|
December 01, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston |
On 12/1/2011 12:45 AM, Don Clugston wrote:
>
> The hex digits are 4 higher than they should be, in every case.
> '0'-> '4', '2'->'6', '9' -> 'D', etc.
> The hex digits are set in this function:
>
> void toHexZeroPadded(char[] output, uint value)
> {
> ptrdiff_t x = output.length - 1;
> static immutable string hexDigits = "0123456789ABCDEF";
> for( ; x>=0; --x)
> {
> output[x] = hexDigits[value& 0xF];
> value>>= 4;
> }
> }
>
> This really looks as though hexDigits is the wrong address. Maybe
> because it's a local static variable.
> I predict that a minimal test case would be:
>
> void foo(uint value)
> {
> static immutable string hexDigits = "0123456789ABCDEF";
> assert( hexDigits[value& 0xF] == '0');
> }
> void main()
> {
> foo(0);
> }
> _______________________________________________
>
I tried various iterations on this and can't get a failure. Grrrr...
|
December 01, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | I'm pretty sure it's a compiler bug. I'm trying to track it down. |
December 02, 2011 [dmd-internals] OSX 64 bit | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright |
On 11/30/2011 12:27 AM, Walter Bright wrote:
> The compiler is passing the test suite now, the only failure is in the unit tests of std.bigint.
Yay, the autotester passes bigint now!
std.regex on OSX is now the open bugaboo.
|
Copyright © 1999-2021 by the D Language Foundation