summaryrefslogtreecommitdiff
path: root/Source/Kernel/Library
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-09-18 14:26:29 +0200
committerAlexis211 <alexis211@gmail.com>2009-09-18 14:26:29 +0200
commitf593816bc9c32a8570cf65697183f314348e8e87 (patch)
treeae4cb3fbc64834818a6aabe04cfdd429e9da70b5 /Source/Kernel/Library
parent8862994499de563b763607fff3f39a8a28c553b3 (diff)
downloadMelon-f593816bc9c32a8570cf65697183f314348e8e87.tar.gz
Melon-f593816bc9c32a8570cf65697183f314348e8e87.zip
Changes in mutexes, vectors and VTs :
mutexes now use the atomic_exchang defined in Task.wtf.asm some vector methods are now declared const VTs now can display (decimal) 64bit integers
Diffstat (limited to 'Source/Kernel/Library')
-rw-r--r--Source/Kernel/Library/String.class.cpp10
-rw-r--r--Source/Kernel/Library/String.class.h4
-rw-r--r--Source/Kernel/Library/Vector.class.cpp10
-rw-r--r--Source/Kernel/Library/Vector.class.h10
4 files changed, 18 insertions, 16 deletions
diff --git a/Source/Kernel/Library/String.class.cpp b/Source/Kernel/Library/String.class.cpp
index 9d4083b..7c2bbc0 100644
--- a/Source/Kernel/Library/String.class.cpp
+++ b/Source/Kernel/Library/String.class.cpp
@@ -196,9 +196,10 @@ String String::concat (WChar other) const {
return (ret += other);
}
-s32int String::toInt() const {
+s64int String::toInt() const {
if (m_string == 0) return 0;
- s32int pos = 0, number = 0;
+ s32int pos = 0;
+ s64int number = 0;
bool negative = false;
if (m_string[0].value == '-') {
negative = true;
@@ -213,9 +214,10 @@ s32int String::toInt() const {
return number;
}
-u32int String::toInt16() const {
+u64int String::toInt16() const {
if (m_string == 0) return 0;
- u32int pos = 0, number = 0;
+ u32int pos = 0;
+ u64int number = 0;
if (m_string[0].value == '0' && m_string[1].value == 'x') pos = 2;
while (1) {
char c = m_string[pos];
diff --git a/Source/Kernel/Library/String.class.h b/Source/Kernel/Library/String.class.h
index 6a9de64..6216415 100644
--- a/Source/Kernel/Library/String.class.h
+++ b/Source/Kernel/Library/String.class.h
@@ -46,8 +46,8 @@ class String {
String operator+ (const char* other) const { return concat(other); }
String operator+ (WChar other) const { return concat(other); }
- s32int toInt() const; //Convert from DEC
- u32int toInt16() const; //Convert from HEX
+ s64int toInt() const; //Convert from DEC
+ u64int toInt16() const; //Convert from HEX
WChar& operator[] (int index) const;
diff --git a/Source/Kernel/Library/Vector.class.cpp b/Source/Kernel/Library/Vector.class.cpp
index 8b032ca..02ae9be 100644
--- a/Source/Kernel/Library/Vector.class.cpp
+++ b/Source/Kernel/Library/Vector.class.cpp
@@ -66,7 +66,7 @@ Vector<T>::~Vector() {
}
template <typename T>
-T& Vector<T>::operator[] (u32int index) {
+T& Vector<T>::operator[] (u32int index) const {
return m_data[index];
}
@@ -106,23 +106,23 @@ void Vector<T>::pop() {
}
template <typename T>
-T& Vector<T>::back() {
+T& Vector<T>::back() const {
return m_data[m_size - 1];
}
template <typename T>
-T& Vector<T>::front() {
+T& Vector<T>::front() const {
return m_data[0];
}
template <typename T>
-u32int Vector<T>::size() {
+u32int Vector<T>::size() const {
return m_size;
}
template <typename T>
-bool Vector<T>::empty() {
+bool Vector<T>::empty() const {
return m_size == 0;
}
diff --git a/Source/Kernel/Library/Vector.class.h b/Source/Kernel/Library/Vector.class.h
index ca86c2a..61c26a4 100644
--- a/Source/Kernel/Library/Vector.class.h
+++ b/Source/Kernel/Library/Vector.class.h
@@ -17,17 +17,17 @@ class Vector {
Vector<T>& operator= (const Vector<T> &other);
~Vector();
- T& operator[] (u32int index);
+ T& operator[] (u32int index) const;
void push(const T& element);
//void push(T& element);
void pop();
- T& back();
- T& front();
+ T& back() const;
+ T& front() const;
- u32int size();
- bool empty();
+ u32int size() const;
+ bool empty() const;
void clear();
};