Home | History | Annotate | Download | only in translator
      1 //
      2 // Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 
      7 #include "compiler/translator/util.h"
      8 
      9 #include <limits>
     10 
     11 #include "compiler/preprocessor/numeric_lex.h"
     12 
     13 bool atof_clamp(const char *str, float *value)
     14 {
     15     bool success = pp::numeric_lex_float(str, value);
     16     if (!success)
     17         *value = std::numeric_limits<float>::max();
     18     return success;
     19 }
     20 
     21 bool atoi_clamp(const char *str, int *value)
     22 {
     23     bool success = pp::numeric_lex_int(str, value);
     24     if (!success)
     25         *value = std::numeric_limits<int>::max();
     26     return success;
     27 }
     28 
     29