[QUOTE]\n[QUOTE]\n[QUOTE]\nI need to get a ceil value from two integers\n[...]\nWhat is the "cleanest" but most compatible way? My program in this instance\nalways uses integers greater than zero and less than 128. Is there another\n(speedier?) way other than using ceil()?[/QUOTE]\n\n i = (i5 + i2 - 1) / i2;[/QUOTE]\n\nNow there's a trick .... I learned it in a long-ago PPOE and think\nit's kind of a clever hack.[/QUOTE]\n\nIt never struck me as either clever or hackish, but only as a\nfairly obvious transformation. (Decades ago I thought it up myself,\nso it can't be *that* abstruse!)\n[QUOTE]\nBut I don't know that I've observed\nanyone other than the long-ago colleague (and myself) using it.[/QUOTE]\n\nEssentially the same thing is often done with multiples\nof powers of two:\n\nunsigned int nextEven = (value + 1u) & ~1u;\nunsigned int nextSixteen = (value + 15u) & ~15u;\nunsigned int nextK = (value + 1023u) & ~1023u;\n// ... etc.\n\n(`unsigned' because bit-twiddling's safer that way).\n[QUOTE]\nBut apparently some others in this thread know about it, and also\nknow that it *can* run up against problems with overflow. "Hm!" ?[/QUOTE]\n\nIf it encounters overflow with "integers greater than zero\nand less than 128" it's being run on a non-conforming or non-C\nimplementation.