News for hackers. Stuff that matters.
Re:C to Java Translation. Automatic, Complete, Correct. Free... by snnw on Wednesday April 29, 2015 @09:24AM (#9458065)
Re:C to Java Translation. Automatic, Complete, Correct. Free... by marco2357 on Wednesday April 29, 2015 @09:29AM (#9458090)
I saw that ;-) The translation is:

  do {

    to.set((from = from.shift(1)).get(-1));

  } while(--count > 0);

which looks correct to me. Hence my question what orodley thinks is wrong.
Re:C to Java Translation. Automatic, Complete, Correct. Free... by jmuhlich on Wednesday April 29, 2015 @10:08AM (#9458310)
I think you might be looking at the wrong thing on the Wikipedia page. The core feature of Duff's Device is interleaved switch and do statements:

  n = (count + 7) / 8;
  switch (count % 8) {
  case 0: do { *to = *from++;
  case 7:      *to = *from++;
  case 6:      *to = *from++;
  case 5:      *to = *from++;
  case 4:      *to = *from++;
  case 3:      *to = *from++;
  case 2:      *to = *from++;
  case 1:      *to = *from++;
          } while (--n > 0);
  }
(extraneous register statements removed for conciseness)
Re:C to Java Translation. Automatic, Complete, Correct. Free... by marco2357 on Wednesday April 29, 2015 @04:22PM (#9461460)
That would be a bug in the translation. We'll investigate. Thanks!
Re:C to Java Translation. Automatic, Complete, Correct. Free... by marco2357 on Thursday April 30, 2015 @07:38AM (#9464399)
Yes indeed. We handled goto into do-while statements wrong. Fixed now. Thanks!