Thanks for using Compiler Explorer
Sponsors
Jakt
C++
Ada
Analysis
Android Java
Android Kotlin
Assembly
C
C3
Carbon
C++ (Circle)
CIRCT
Clean
CMake
CMakeScript
COBOL
C++ for OpenCL
MLIR
Cppx
Cppx-Blue
Cppx-Gold
Cpp2-cppfront
Crystal
C#
CUDA C++
D
Dart
Elixir
Erlang
Fortran
F#
GLSL
Go
Haskell
HLSL
Hook
Hylo
IL
ispc
Java
Julia
Kotlin
LLVM IR
LLVM MIR
Modula-2
Nim
Objective-C
Objective-C++
OCaml
OpenCL C
Pascal
Pony
Python
Racket
Ruby
Rust
Snowball
Scala
Solidity
Spice
SPIR-V
Swift
LLVM TableGen
Toit
TypeScript Native
V
Vala
Visual Basic
WASM
Zig
Javascript
GIMPLE
Ygen
csharp source #1
Output
Compile to binary object
Link to binary
Execute the code
Intel asm syntax
Demangle identifiers
Verbose demangling
Filters
Unused labels
Library functions
Directives
Comments
Horizontal whitespace
Debug intrinsics
Compiler
.NET (main)
.NET 6.0.110
.NET 6.0.113
.NET 6.0.116
.NET 7.0.100
.NET 7.0.102
.NET 7.0.105
.NET CoreCLR (main)
.NET CoreCLR 7.0
.NET CoreCLR 8.0
.NET Crossgen2 (main)
.NET Crossgen2 6.0
.NET Crossgen2 7.0
.NET Crossgen2 8.0
.NET IL Disassembler (main)
.NET Mono (main)
.NET NativeAOT (main)
Options
Source code
using System; public static class C { public static uint AddCarry(uint left, uint right, out bool carry){ var res = left + right; carry = res < left; return res; } public static uint SubtractIfLargerOrEqual(uint left, uint right, out bool carry){ bool cf = false; var res = left - right; //CF is set if left < right cf = res > left; //CF can be verified by `res > left` as the res doesn't become greater than the left unless the left is less than the right for unsigned integers. if (cf) res = left; carry = cf; return res; } }
Become a Patron
Sponsor on GitHub
Donate via PayPal
Source on GitHub
Mailing list
Installed libraries
Wiki
Report an issue
How it works
Contact the author
CE on Mastodon
About the author
Statistics
Changelog
Version tree