Opened 8 years ago

Closed 7 years ago

## #4466 closed defect (fixed)

# flashsv2enc warning while trying to take the absolute value of an unsigned int

Reported by: | Jeremy Huddleston | Owned by: | |
---|---|---|---|

Priority: | minor | Component: | avcodec |

Version: | git-master | Keywords: | |

Cc: | Blocked By: | ||

Blocking: | Reproduced by developer: | no | |

Analyzed by developer: | no |

## Description

It looks like you might want to just cast to int to address this warning:

src/libavcodec/flashsv2enc.c:418:12: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) + ^ src/libavcodec/flashsv2enc.c:418:12: note: remove the call to 'abs' since unsigned values cannot be negative return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) + ^~~ src/libavcodec/flashsv2enc.c:418:27: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) + ^ src/libavcodec/flashsv2enc.c:418:27: note: remove the call to 'abs' since unsigned values cannot be negative return abs(t1 - t2) + abs((c1 & 0x000000ff) - (c2 & 0x000000ff)) + ^~~ src/libavcodec/flashsv2enc.c:419:9: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] abs(((c1 & 0x0000ff00) >> 8) - ((c2 & 0x0000ff00) >> 8)) + ^ src/libavcodec/flashsv2enc.c:419:9: note: remove the call to 'abs' since unsigned values cannot be negative abs(((c1 & 0x0000ff00) >> 8) - ((c2 & 0x0000ff00) >> 8)) + ^~~ src/libavcodec/flashsv2enc.c:420:9: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] abs(((c1 & 0x00ff0000) >> 16) - ((c2 & 0x00ff0000) >> 16)); ^ src/libavcodec/flashsv2enc.c:420:9: note: remove the call to 'abs' since unsigned values cannot be negative abs(((c1 & 0x00ff0000) >> 16) - ((c2 & 0x00ff0000) >> 16)); ^~~ 4 warnings generated.

### Change History (1)

### comment:1 by , 7 years ago

Resolution: | → fixed |
---|---|

Status: | new → closed |

Version: | unspecified → git-master |

**Note:**See TracTickets for help on using tickets.

Fixed by Ganesh Ajjanagadde in 0fe1c50e505125cf2b026d810458bc5cbc242792