suggested improvements to D

BCS ao at pathlink.com
Mon Jan 8 19:00:27 PST 2007


Reply to Warren,

> popcount and first1:

available using intrinsics

> to work as a way to loop thru the elements of the set.
> This was all very fine.  It led to TREMENDOUS speedup and
> simplification of the right kinds of programs.
> BUT, later hardware got rid of the instruction and languages
> did not have these as features.  Vicious circle:
> Hardware designers:  no language has popcount and first1, so we see
> no
> reason to support it in hardware.
> Language designers: hardware does not support these, so why should
> our language?
> Break the cycle - put these in D!   This'll speed up chess programs by
> a factor of 2.
> 

IIRC thay can be emulated with a bit not and an add or subtract (I forget 
exactly how)

> Undenying access to arithmetic:
> hardware goes to a great amount of trouble to provide add-with-carry,
> multiply-two-singlewords-to-get-a-doubleword,
> long-division-with-quotient&remainder
> (if a is a doubleword divide a by b to get quotient q and remainder r,
> all singlewords), etc. to us.
[...]
> to build a bignum package.  It is just gratuitously asinine.  If D
> delivered this it'd (a) be veyr easy, (b) instantly attract a lot of
> converts
> and you could build a portable bignum code that ran about 4
> times faster.
> Warren D. Smith

take a look at this:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.announce&article_id=6217

Not fantastically clean, but language support for these without using inline 
ASM would be "difficult".





More information about the Digitalmars-d mailing list