patch 9.0.2066: xxd: corrupting files when reversing bit dumps

Problem:  xxd: corrupting files when reversing bit dumps
Solution: handle reversing bit dump slightly differently

fixes:  #13410
closes: #13415

Co-authored-by: OldWorldOrdr <joey.t.reinhart@gmail.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: K.Takata <kentkt@csc.jp>
Signed-off-by: tristhaus <tristhaus@yahoo.de>
diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim
index 53e1a95..7a2771e 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -373,6 +373,13 @@
   bwipe!
 endfunc
 
+func Test_xxd_roundtrip_large_bit_dump()
+  new
+  exe 'r! printf "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ' . s:xxd_cmd . ' -b | ' . s:xxd_cmd . ' -r -b'
+  call assert_match('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678', join(getline(1, 3)))
+  bwipe!
+endfunc
+
 func Test_xxd_version()
   new
   exe 'r! ' . s:xxd_cmd . ' -v'