1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-16 15:24:10 +02:00

Mac fixes

This commit is contained in:
Brian Fiete 2020-04-16 00:14:25 -07:00
parent c84da66758
commit 8709c92f22
4 changed files with 23 additions and 2 deletions

View file

@ -113,6 +113,16 @@ public:
{ {
return mPtr < val2.mPtr; return mPtr < val2.mPtr;
} }
bool operator>(const iterator& val2)
{
return mPtr > val2.mPtr;
}
bool operator>=(const iterator& val2)
{
return mPtr >= val2.mPtr;
}
}; };
struct const_iterator struct const_iterator

View file

@ -123,7 +123,7 @@ intptr StringView::LastIndexOf(char c) const
return -1; return -1;
} }
intptr StringView::LastIndexOf(char c, intptr startCheck) const intptr StringView::LastIndexOf(char c, int startCheck) const
{ {
auto ptr = mPtr; auto ptr = mPtr;
for (intptr i = startCheck; i >= 0; i--) for (intptr i = startCheck; i >= 0; i--)
@ -132,6 +132,15 @@ intptr StringView::LastIndexOf(char c, intptr startCheck) const
return -1; return -1;
} }
intptr StringView::LastIndexOf(char c, int64 startCheck) const
{
auto ptr = mPtr;
for (intptr i = (intptr)startCheck; i >= 0; i--)
if (ptr[i] == c)
return i;
return -1;
}
String StringView::ToString() const String StringView::ToString() const
{ {
return String(this->mPtr, this->mLength); return String(this->mPtr, this->mLength);

View file

@ -1831,7 +1831,7 @@ void BfIRBuilder::Write(const BfIRTypeData& type)
{ {
auto sizedArrayType = (BfConstantSizedArrayType*)GetConstantById(type.mId); auto sizedArrayType = (BfConstantSizedArrayType*)GetConstantById(type.mId);
Write(sizedArrayType->mType); Write(sizedArrayType->mType);
WriteSLEB128(sizedArrayType->mLength); WriteSLEB128((int64)sizedArrayType->mLength);
} }
else if (type.mKind != BfIRTypeData::TypeKind_None) else if (type.mKind != BfIRTypeData::TypeKind_None)
WriteSLEB128(type.mId); WriteSLEB128(type.mId);

View file

@ -410,6 +410,8 @@ struct BfCodeGenOptions
HashContext hashCtx; HashContext hashCtx;
hashCtx.Mixin(mWriteObj); hashCtx.Mixin(mWriteObj);
hashCtx.Mixin(mWriteBitcode);
hashCtx.Mixin(mAsmKind);
hashCtx.Mixin(mWriteToLib); hashCtx.Mixin(mWriteToLib);
hashCtx.Mixin(mWriteLLVMIR); hashCtx.Mixin(mWriteLLVMIR);
hashCtx.Mixin(mVirtualMethodOfs); hashCtx.Mixin(mVirtualMethodOfs);