Skip to content

Commit

Permalink
Remove old EH count code
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsck committed Dec 6, 2021
1 parent c8b150f commit 086cda2
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/DotNet/Emit/MethodBodyReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,9 @@ void ReadExceptionHandlers(out uint totalBodySize) {
totalBodySize = 0;
}

static ushort GetNumberOfExceptionHandlers(uint num) {
// The CLR truncates the count so num handlers is always <= FFFFh.
return (ushort)num;
}

void ReadFatExceptionHandlers(ref DataReader ehReader) {
ehReader.Position--;
int num = GetNumberOfExceptionHandlers((ehReader.ReadUInt32() >> 8) / 24);
int num = (int)((ehReader.ReadUInt32() >> 8) / 24);
for (int i = 0; i < num; i++) {
var eh = new ExceptionHandler((ExceptionHandlerType)ehReader.ReadUInt32());
uint offs = ehReader.ReadUInt32();
Expand All @@ -505,7 +500,7 @@ void ReadFatExceptionHandlers(ref DataReader ehReader) {
}

void ReadSmallExceptionHandlers(ref DataReader ehReader) {
int num = GetNumberOfExceptionHandlers((uint)ehReader.ReadByte() / 12);
int num = (int)((uint)ehReader.ReadByte() / 12);
ehReader.Position += 2;
for (int i = 0; i < num; i++) {
var eh = new ExceptionHandler((ExceptionHandlerType)ehReader.ReadUInt16());
Expand Down

0 comments on commit 086cda2

Please sign in to comment.