byte-to-position

byte-to-position is a built-in function in `C source code'.

(byte-to-position BYTEPOS)

Return the character position for byte position BYTEPOS.
If BYTEPOS is out of range, the value is nil.