[M3devel] hand.c/set_singleton?

Jay K jay.krell at cornell.edu
Wed Feb 24 00:14:51 CET 2010


I think hand.c is worth shrinking.

  And converting where easy to Modula-3.

Agreed?

It is "exercise" at least -- learn and get comfortable making changes, as long as they don't make anything worse.

 

 

With that in mind, any hints on this:

 

 

void set_singleton(size_t a, size_t* s)
{
  size_t a_word = a / SET_GRAIN;
  size_t a_bit  = a % SET_GRAIN;
  s[a_word] |= (1UL << a_bit);
}


 

Leave it alone? It works, not worth changing?

Deal with it in m3front?

In parse.c?

 

 

I changed m3back to generate a bts instruction, which achieves "all four" operations in one instruction -- div (shift), mod (and), shift, or. The semantic mapping seems to be 100%. If set_singleton were a common operation, which I doubt, it seems like a major gain.

 

 

 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100223/23dbd706/attachment-0001.html>


More information about the M3devel mailing list