util: Further consolidate the Args interface in the m5 utility.
[gem5.git] / util / m5 / src / args.cc
index b6bd1c8f75efb6824fe4c0a09e43913db5673f67..1caad43941723bba47220cb4921bb4aaff659b6e 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <cinttypes>
-#include <cstdlib>
 #include <cstring>
 
 #include "args.hh"
 
 bool
-parse_int_args(Args &args, uint64_t ints[], int len)
-{
-// On 32 bit platforms we need to use strtoull to do the conversion
-#ifdef __LP64__
-#define strto64 strtoul
-#else
-#define strto64 strtoull
-#endif
-    for (int i = 0; i < len; ++i)
-        ints[i] = strto64(args.pop("0").c_str(), NULL, 0);
-
-#undef strto64
-    return true;
-}
-
-bool
-pack_arg_into_regs(Args &args, uint64_t regs[], int num_regs)
+Args::pack(const std::string &str, uint64_t regs[], int num_regs)
 {
     const size_t RegSize = sizeof(regs[0]);
     const size_t MaxLen = num_regs * RegSize;
-    const std::string &sarg = args.pop();
-    const char *arg = sarg.c_str();
+    const char *arg = str.c_str();
 
     memset(regs, 0, MaxLen);
 
-    size_t len = sarg.size();
+    size_t len = str.size();
 
     if (len > MaxLen)
         return false;