blob: e20068b66dcb14ab3082f28fd9d53de3107dc282 [file] [log] [blame]
//
// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include <limits>
#include "util.h"
#include "preprocessor/numeric_lex.h"
bool atof_clamp(const char *str, float *value)
{
bool success = pp::numeric_lex_float(str, value);
if(!success)
*value = std::numeric_limits<float>::max();
return success;
}
bool atoi_clamp(const char *str, int *value)
{
bool success = pp::numeric_lex_int(str, value);
if(!success)
*value = std::numeric_limits<int>::max();
return success;
}