Comments (2)
If you add the instruction bytes to the IL output, (The setting can be found in Settings > Display > Decompilation view options > last checkbox).
.method /* 06003173 */ public hidebysig static
int32 ReadInt32BigEndian (
valuetype System.ReadOnlySpan`1<uint8> source
) cil managed aggressiveinlining
{
// Method begins at RVA 0x64c5d4
// Header size: 1
// Code size: 19 (0x13)
.maxstack 8
/* 0x0064C5D5 7E78030004 */ IL_0000: ldsfld bool System.BitConverter::IsLittleEndian /* 04000378 */
/* 0x0064C5DA 2D00 */ IL_0005: brtrue.s IL_0007
/* 0x0064C5DC 02 */ IL_0007: ldarg.0
/* 0x0064C5DD 284704002B */ IL_0008: call !!0 System.Runtime.InteropServices.MemoryMarshal::Read<int32>(valuetype System.ReadOnlySpan`1<uint8>) /* 2B000447 */
/* 0x0064C5E2 2865310006 */ IL_000d: call int32 System.Buffers.Binary.BinaryPrimitives::ReverseEndianness(int32) /* 06003165 */
/* 0x0064C5E7 2A */ IL_0012: ret
} // end of method BinaryPrimitives::ReadInt32BigEndian
You will see that the bytes of the instruction are 0x2D00, where 0x2D is the opcode for brtrue.s
:
Taken from ECMA-335, 6th edition, June 2012, page 297
and 0x00 is the relative offset to jump to, which basically is "don't jump at all".
Not sure what the C# compiler is trying to do, but it seems pointless. I don't think ILSpy is at fault here. Probably some branch optimization gone wrong in the compiler.
from ilspy.
Converter.IsLittleEndian
is marked with an IntrinsicAttribute
, so it seems there is something special going on. May I ask you to open a discussion on the dotnet/runtime repo?
from ilspy.
Related Issues (20)
- Can we get the ast of il and a visitor? HOT 1
- AnalyserScope goes to infinite loop when analysing public inner class HOT 3
- Decompile baml files with ILSpyCmd HOT 1
- ILSpy support for .NET 9 HOT 1
- The difference between ICSharpCode.Decompiler.dll and ILSPY decomplie
- Option to disable linq expression syntax in ilspycmd
- ICSharpCode.Decompiler.TypeSystem.IType property values should match System.Reflection.Type property values
- Drag and drop a folder to ILSpy?
- ILSpy Developer Meeting 2024, July 19th-21st
- How to decompile Assembly-CSharp.dll? HOT 3
- OverridableAttribute missing from the decompiled code when using a winmd file. HOT 1
- Interface improvements, lengthen what needs to be long and shorten what shouldn't
- Inconsistent and uncompilable decompilation for a combination of null forgiving operator and extension method usage
- Wrong decompilation of null nullable int
- System.NullReferenceException: Object reference not set to an instance of an object. HOT 3
- Installation Path HOT 2
- ICSharpCode.ILSpy.AssertionFailedException: StackTypes must match!
- System.NullReferenceException: Object reference not set to an instance of an object.
- Redesign the App Icon to match the Windows 11 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ilspy.