Hacker News new | past | comments | ask | show | jobs | submit login

But you do have CPL -- that does not help? Anyway, without subtraction, you could do the very same with one additional add:

  int16_t celsius2fahrenheit(int16_t c)
  {
    int16_t f = 0;
    f += c << 1;
    f += c << 2;
    f += c << 3;
    f += c >> 2;
    f += c >> 3;
    f += c >> 5;
    f += 320 * 8;
    f >>= 3;
    return f;
  }



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: