Browse Source

Some optimizations

Forgot to update copyright year in previous commit.
release/0.19
JustinAJ 10 years ago
parent
commit
6cc2a14859
  1. 4
      Jupiter/ArrayList.h
  2. 2
      Jupiter/IRC.h
  3. 53
      Jupiter/Readable_String_Imp.h
  4. BIN
      Release/Jupiter.lib

4
Jupiter/ArrayList.h

@ -182,8 +182,8 @@ template<typename T> void Jupiter::ArrayList<T>::empty()
template<typename T> void Jupiter::ArrayList<T>::emptyAndDelete() template<typename T> void Jupiter::ArrayList<T>::emptyAndDelete()
{ {
for (size_t i = 0; i < Jupiter::List<T>::length; i++) delete Jupiter::ArrayList<T>::data[i]; while (Jupiter::List<T>::length != 0)
Jupiter::List<T>::length = 0; delete Jupiter::ArrayList<T>::data[--Jupiter::List<T>::length];
} }
template<> struct _Jupiter_DataBuffer_partial_specialization_impl<Jupiter::ArrayList> template<> struct _Jupiter_DataBuffer_partial_specialization_impl<Jupiter::ArrayList>

2
Jupiter/IRC.h

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2013-2014 Justin James. * Copyright (C) 2013-2015 Justin James.
* *
* This license must be preserved. * This license must be preserved.
* Any applications, libraries, or code which make any use of any * Any applications, libraries, or code which make any use of any

53
Jupiter/Readable_String_Imp.h

@ -1117,27 +1117,48 @@ template<typename T> template<template<typename> class R> R<T> Jupiter::Readable
template<typename T> template<template<typename> class R> R<T> Jupiter::Readable_String<T>::getWord(const T *in, size_t pos, const T *whitespace) template<typename T> template<template<typename> class R> R<T> Jupiter::Readable_String<T>::getWord(const T *in, size_t pos, const T *whitespace)
{ {
unsigned int x = 0; if (*in == 0)
unsigned int y = 1; return R<T>();
for (unsigned int i = 0; i < pos || y == 1; x++)
{ while (Jupiter::strpbrk<T>(whitespace, *in) != nullptr)
if (in[x] == 0) return R<T>(); if (*++in == 0)
if (Jupiter::strpbrk<T>(whitespace, in[x]) != nullptr) return R<T>();
{
if (y != 1) if (pos == 0)
{ {
y = 1; do
i++; ++in, ++pos;
} while (*in != 0 && Jupiter::strpbrk<T>(whitespace, *in) == nullptr);
in -= pos;
return R<T>::substring(in, 0, pos);
} }
else
loop_start:
{ {
if (i >= pos) break; if (Jupiter::strpbrk<T>(whitespace, *in) != nullptr)
y = 0; {
do
if (*++in == 0)
return R<T>();
while (Jupiter::strpbrk<T>(whitespace, *in) != nullptr);
if (--pos == 0)
goto loop_end;
} }
if (++in == 0)
return R<T>();
goto loop_start;
} }
for (y = x; in[y] != 0 && Jupiter::strpbrk<T>(whitespace, in[y]) == nullptr; y++); loop_end:
return R<T>::substring(in, x, y - x);
do
++in, ++pos;
while (*in != 0 && Jupiter::strpbrk<T>(whitespace, *in) == nullptr);
in -= pos;
return R<T>::substring(in, 0, pos);
} }
// getToken // getToken

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save