Unified · Split
| @@ -282,9 +282,13 @@ that the phase is within the range 0 and 1. while loops · 281 unmodified lines | |||
| 282 | are used in place of things like =fmod= because they are | 282 | are used in place of things like =fmod= because they are |
| 283 | less expensive. | 283 | less expensive. |
| 284 | 284 | ||
| 285 | A note that the phase cannot be *exactly* 1, hence the | ||
| 286 | greather than *or* equal to. (This mistake was figured out | ||
| 287 | the hard way by the author). | ||
| 288 | |||
| 285 | #+NAME: bounds_checking | 289 | #+NAME: bounds_checking |
| 286 | #+BEGIN_SRC c | 290 | #+BEGIN_SRC c |
| 287 | while (phs > 1) phs--; | 291 | while (phs >= 1) phs--; |
| 288 | while (phs < 0) phs++; | 292 | while (phs < 0) phs++; |
| 289 | #+END_SRC | 293 | #+END_SRC |
| 290 | * Variation: external phase control | 294 | * Variation: external phase control |