atoi implementation