inv_identity: avoid signed int overflow for 12-bit files

Fixes #220.
12 jobs for master in 5 minutes and 42 seconds (queued for 3 seconds)
Status Job ID Name Coverage
  Build
passed #242853
amd64 debian
build-debian

00:00:33

passed #242857
debian aarch64
build-debian-aarch64

00:01:25

passed #242858
debian aarch64
build-debian-aarch64-clang-5

00:01:09

passed #242854
amd64 debian
build-debian-static

00:00:31

passed #242860
debian aarch64
build-debian-werror

00:00:33

passed #242859
macos
build-macos

00:00:26

passed #242855
win32
build-win32

00:00:29

passed #242856
win64
build-win64

00:00:34

 
  Test
passed #242861
amd64 debian
test-debian

00:00:43

passed #242862
amd64 debian
test-debian-asan

00:02:03

passed #242863
amd64 debian
test-debian-msan

00:00:57

passed #242864
amd64 debian
test-debian-ubsan

00:01:22