2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2020 - ESI Group - Clement DAVID
4 * Copyright (C) 2014 - Scilab Enterprises - Cedric Delamarre
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
26 // similar API to std::stoi but does not throw
27 // Adapted from http://tinodidriksen.com/uploads/code/cpp/speed-string-to-int.cpp
28 int os_wtoi(const wchar_t* str, std::size_t* pos)
30 const wchar_t* p = str;
38 while (*p >= '0' && *p <= '9')
40 x = (x * 10) + (*p - '0');