History

Use INFINITY and NAN macros instead of 1/0 and 0/0

Mans Rullgard committed 16 years ago

Commit 324e7ee1 parent f318ee32 files · +5 −5Browse files

Unified · Split

2 files
  1. cmdutils.c +1 −1
  2. libavutil/intfloat_readwrite.c +4 −4
cmdutils.c+1−1
@@ -198,7 +198,7 @@ unknown_opt: · 197 unmodified lines
198198 } else if (po->flags & OPT_INT64) {
199199 *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
200200 } else if (po->flags & OPT_FLOAT) {
201− *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
201+ *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
202202 } else if (po->flags & OPT_FUNC2) {
203203 if (po->u.func2_arg(opt, arg) < 0) {
204204 fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
libavutil/intfloat_readwrite.c+4−4
@@ -31,13 +31,13 @@ · 30 unmodified lines
3131
3232 double av_int2dbl(int64_t v){
3333 if(v+v > 0xFFEULL<<52)
34− return 0.0/0.0;
34+ return NAN;
3535 return ldexp(((v&((1LL<<52)-1)) + (1LL<<52)) * (v>>63|1), (v>>52&0x7FF)-1075);
3636 }
3737
3838 float av_int2flt(int32_t v){
3939 if(v+v > 0xFF000000U)
40− return 0.0/0.0;
40+ return NAN;
4141 return ldexp(((v&0x7FFFFF) + (1<<23)) * (v>>31|1), (v>>23&0xFF)-150);
4242 }
4343
@@ -49,7 +49,7 @@ double av_ext2dbl(const AVExtFloat ext){ · 5 unmodified lines
4949 m = (m<<8) + ext.mantissa[i];
5050 e = (((int)ext.exponent[0]&0x7f)<<8) | ext.exponent[1];
5151 if (e == 0x7fff && m)
52− return 0.0/0.0;
52+ return NAN;
5353 e -= 16383 + 63; /* In IEEE 80 bits, the whole (i.e. 1.xxxx)
5454 * mantissa bit is written as opposed to the
5555 * single and double precision formats. */
@@ -88,7 +88,7 @@ AVExtFloat av_dbl2ext(double d){ · 32 unmodified lines
8888 ext.mantissa[i] = m>>(56-(i<<3));
8989 } else if (f != 0.0) {
9090 ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
91− if (f != 1/0.0)
91+ if (f != INFINITY)
9292 ext.mantissa[0] = ~0;
9393 }
9494 if (d < 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t