summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-array-view.h2
-rw-r--r--source/core/slang-hash.h2
-rw-r--r--source/core/slang-list.h5
-rw-r--r--source/core/slang-short-list.h8
-rw-r--r--source/core/slang-token-reader.cpp2
5 files changed, 13 insertions, 6 deletions
diff --git a/source/core/slang-array-view.h b/source/core/slang-array-view.h
index 99609ef69..50270e0a0 100644
--- a/source/core/slang-array-view.h
+++ b/source/core/slang-array-view.h
@@ -197,6 +197,8 @@ namespace Slang
return ThisType(m_buffer + index, m_count - index);
}
+ T& getLast() { return m_buffer[m_count - 1]; }
+
ArrayView() : Super() {}
ArrayView(T* buffer, Index size) :Super(buffer, size) {}
};
diff --git a/source/core/slang-hash.h b/source/core/slang-hash.h
index bc4b30ccc..5f6b1b060 100644
--- a/source/core/slang-hash.h
+++ b/source/core/slang-hash.h
@@ -138,7 +138,7 @@ namespace Slang
template<typename TKey>
static HashCode getHashCode(TKey const& key)
{
- return (HashCode)((PtrInt)key) / 16; // sizeof(typename std::remove_pointer<TKey>::type);
+ return (HashCode)((PtrInt)key) >> 2; // sizeof(typename std::remove_pointer<TKey>::type);
}
};
template<>
diff --git a/source/core/slang-list.h b/source/core/slang-list.h
index ff756035c..250b6dc49 100644
--- a/source/core/slang-list.h
+++ b/source/core/slang-list.h
@@ -52,6 +52,11 @@ namespace Slang
{
this->operator=(static_cast<List<T>&&>(list));
}
+ List(ArrayView<T> view)
+ : List()
+ {
+ addRange(view);
+ }
static List<T> makeRepeated(const T& val, Index count)
{
List<T> rs;
diff --git a/source/core/slang-short-list.h b/source/core/slang-short-list.h
index 5bad9faf8..adbb935e6 100644
--- a/source/core/slang-short-list.h
+++ b/source/core/slang-short-list.h
@@ -117,17 +117,17 @@ namespace Slang
}
};
- Iterator begin()
+ Iterator begin() const
{
Iterator rs;
- rs.container = this;
+ rs.container = const_cast<ThisType*>(this);
rs.index = 0;
return rs;
}
- Iterator end()
+ Iterator end() const
{
Iterator rs;
- rs.container = this;
+ rs.container = const_cast<ThisType*>(this);
rs.index = m_count;
return rs;
}
diff --git a/source/core/slang-token-reader.cpp b/source/core/slang-token-reader.cpp
index f6f29def3..e8ebfb9ec 100644
--- a/source/core/slang-token-reader.cpp
+++ b/source/core/slang-token-reader.cpp
@@ -416,7 +416,7 @@ namespace Misc {
tokenFlags |= TokenFlag::AtStartOfLine | TokenFlag::AfterWhitespace;
pos++;
}
- else if (curChar == ' ' || curChar == '\t' || curChar == -62 || curChar == -96) // -62/-96:non-break space
+ else if (curChar == ' ' || curChar == '\t' || curChar == '\xC2' || curChar == '\xA0') // -62/-96:non-break space
{
tokenFlags |= TokenFlag::AfterWhitespace;
pos++;