Return nBytes instead of nextAddr from utf8DecodeChar
authorThomas Miedema <thomasmiedema@gmail.com>
Tue, 16 Sep 2014 12:56:35 +0000 (07:56 -0500)
committerAustin Seipp <austin@well-typed.com>
Tue, 16 Sep 2014 12:56:35 +0000 (07:56 -0500)
commitcaf449e39f5e7545eeabd567349661450aa8c6e5
tree2a3124e3f72efc76519fe33c681a41301d14d2d9
parent52eab67a99dd928204b730355245233fa96fa24d
Return nBytes instead of nextAddr from utf8DecodeChar

Summary:
While researching D176, I came across the following simplification
opportunity:

Not all functions that call utf8DecodeChar actually need the address
of the next char. And some need the 'number of bytes' read. So returning
nBytes instead of nextAddr should save a few addition and subtraction
operations, and makes the code a bit simpler.

Test Plan: it validates

Reviewers: simonmar, ezyang, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D179
compiler/utils/Encoding.hs
compiler/utils/FastString.lhs
compiler/utils/StringBuffer.lhs