comparison: src/basics.h
src/basics.h
- changeset 1178
- 3a88e7a60b63
- parent 1177
- 8661b9237ed5
- child 1181
- ca6d0ef9aadb
equal
deleted
inserted
replaced
313 template<typename T> |
313 template<typename T> |
314 int countof(const RingAdapter<T>& ring) |
314 int countof(const RingAdapter<T>& ring) |
315 { |
315 { |
316 return ring.size(); |
316 return ring.size(); |
317 } |
317 } |
|
318 |
|
319 /* |
|
320 * Extracts the sign of x. |
|
321 */ |
|
322 template<typename T> |
|
323 T sign(T x) |
|
324 { |
|
325 if (isZero(x)) |
|
326 return {}; |
|
327 else |
|
328 return x / qAbs(x); |
|
329 } |