gfx/angle/src/compiler/util.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/compiler/util.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +//
     1.5 +// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +#include <math.h>
    1.11 +#include <stdlib.h>
    1.12 +
    1.13 +#include "util.h"
    1.14 +
    1.15 +#ifdef _MSC_VER
    1.16 +    #include <locale.h>
    1.17 +#else
    1.18 +    #include <sstream>
    1.19 +#endif
    1.20 +
    1.21 +double atof_dot(const char *str)
    1.22 +{
    1.23 +#ifdef _MSC_VER
    1.24 +    _locale_t l = _create_locale(LC_NUMERIC, "C");
    1.25 +    double result = _atof_l(str, l);
    1.26 +    _free_locale(l);
    1.27 +    return result;
    1.28 +#else
    1.29 +    double result;
    1.30 +    std::istringstream s(str);
    1.31 +    std::locale l("C");
    1.32 +    s.imbue(l);
    1.33 +    s >> result;
    1.34 +    return result;
    1.35 +#endif
    1.36 +}

mercurial