[Question]
  [
As most of you probably know, (byte-addressable) hardware memories can be divided into two categories - *little-endian* and *big-endian*. In little-endian memories the bytes are numbered starting with 0 at the little (least significant) end and in big-endian ones the other way round.
**Fun fact**: These terms are based on [Jonathan Swift](https://en.wikipedia.org/wiki/Jonathan_Swift)'s book [Gulliver's Travels](https://en.wikipedia.org/wiki/Gulliver%27s_Travels) where the Lilliputian king ordered his citizens to break their eggs on the little end (thus the little-endians) and the rebels would break theirs on the big end.
## How swapping works
Suppose we have an unsigned integer (32bit) `12648430` in memory, in a big-endian machine that might look as follows:
```
  addr: 0  1  2  3
memory: 00 C0 FF EE
```
By inverting the byte-order we get the hexadecimal integer `0xEEFFC000` which is `4009738240` in decimal.
## Your task
Write a program/function that receives an unsigned 32bit integer in decimal and outputs the resulting integer when swapping the endianness as described above.
## Rules
* Input will always be in the range `0` to `4294967295`
* Output can be printed to STDOUT (trailing newlines/spaces are fine) or returned
* Input and output are in decimal
* Behavior on invalid input is left undefined
## Test cases
```
0 -> 0
1 -> 16777216
42 -> 704643072
128 -> 2147483648
12648430 -> 4009738240
16885952 -> 3232235777
704643072 -> 42
3735928559 -> 4022250974
4009738240 -> 12648430
4026531839 -> 4294967279
4294967295 -> 4294967295
```
  
[Answer]
# x86\_32 machine language, 3 bytes
```
endian_swap:        # to be called with PASCAL REGISTER calling convention
0f c8    bswap eax
c3       ret
```
This is a bit of a cheat. The Pascal register calling convention (see [Wikipedia](https://en.wikipedia.org/wiki/X86_calling_conventions#List_of_x86_calling_conventions)) is a bit like \_\_fastcall, except it passes the first parameter in eax, and eax also contains the return value. It's also callee-cleanup, but since we don't use the stack for anything other than the return pointer we don't need to do anything. This allows us to avoid a mov or xchg and just use bswap directly.
[Answer]
# x86\_64 machine language Linux, ~~5~~ 4 bytes
```
0:       0f cf                   bswap  %edi
2:       97                      xchg   %eax,%edi
3:       c3                      retq 
```
Thanks to [@peter ferrie](https://codegolf.stackexchange.com/users/61382/peter-ferrie) for -1.
[Try it online!](https://tio.run/##fZDbisIwFEXf/YpDRUgGR9Jcmhwc/Avf@iJpqwEnM4wWCjLfXtN4B5uH0Cz2XhtS@7m1tp86b/dtVX8djpX7WexW/bSqG@draEhHgZDWH9zW1xU4fyQf9IUpzcquKTsbDurwFRkNVh8i@N44T@hpAvD7F7ghkM1amLWlz@bA5mGeUaDL93k@5Pl4LvlQkDyxwE3c4CbRKYxRqOLW7T7e1kwWUjAd63cY7wstFHKjFK4H4wkT72IMtTBcsug8YcrhhRK5EXh17pj6fyix0BzVxXlgdP77Mw "C (gcc) – Try It Online")
[Answer]
# C (gcc) , ~~20~~, ~~29~~ 17 bytes
@hvd's suggestion.
```
__builtin_bswap32
```
[Try it online!](https://tio.run/##ZcxLCsIwFIXheVZRCpWmtDS9yc2DgisRShtRAnotfeBAdOsxjh0cOHyD3zdX72NbxWGY9nDbAg3T@hxnCbFq2X0MVBJ/XR5L2X9WP9KlzItzXh@I93xeAm0/2LPmmBX7ifKa6r9QCvD@HQXrmALWgU3TyiqZRFuLDoEZoXQCA0waiQ4somNKCGekBSXSBY2yszIpOOW0AYdf)
Old answer;
```
#include<byteswap.h>
bswap_32
```
include should be import.
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), ~~10~~ 14 bytes
```
sG ùT8 ò w ¬nG
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=c0cg+VQ4IPIgdyCsbkc=&input=OA==)
---
## Explanation
Convert input integer to a base-16 string (`sG`), use `0` to pad the start to length 8 (`ùT8`), split to an array of 2 character strings (`ò`), reverse (`w`), rejoin to a string (`¬`) and convert back to base-10 (`nG`).
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
```
⁴4*+b⁹ḊṚḅ⁹
```
[Try it online!](https://tio.run/##y0rNyan8//9R4xYTLe2kR407H@7oerhz1sMdrUD2////Dc0sLEwtTY0A "Jelly – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 44 bytes
```
f=lambda x,i=3:x and(x%256)<<8*i|f(x>>8,i-1)
```
[Try it online!](https://tio.run/##RZDNasMwEITP8VPspWAXFaRdrX5CnBcJobhNTA2tbRIFXOi7uxtbJCftaGY/DRp/09fQ4zy39Xfz83FqYFJdTdsJmv5UTi/Irtrtwmv315bTfh9U92aqOZ2v6f2zuZ6vUMOh2By0An1UMhgFxnnv0bhFW1TgtXWWtMc1gUEBGuttIGdDvpNJIgqs1tFTQJtxLgSOLBBCQiQW9GI8mLKycskTRwzM8U5BRBaSXUs8oNIuP5UNdEwm0H0Ho43Oo4@5@CojP63IYh2Loh0u0PXjLSkYbklOUfD8k22xGS9dn8q2XFIV1HUOVvM/ "Python 2 – Try It Online")
[Answer]
# APL+WIN 14 bytes
```
256⊥⌽(4⍴256)⊤⎕
```
Explanation
```
⎕ prompt for screen input
(4⍴256)⊤ 4 byte representation in base 256
⌽ reverse bytes
256⊥ bytes from base 256 to integer
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 24 bytes
```
IntegerReverse[#,256,4]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n1aaZ/vfM68kNT21KCi1LLWoODVaWcfI1EzHJFbtf0BRZl5JNFCNgr6DQrWhjoKJkY6CoZEFkDAzsTAxNgAxLCxMLU2B4uYGJmZAIXOj2tj/AA "Wolfram Language (Mathematica) – Try It Online")
Reverses the input interpreted as an integer in base 256 with 4 digits.
[Answer]
# [C#](https://www.microsoft.com/net/core/platform), 70 68 bytes
This is probably not optimal.
**68:**
```
Func<uint,uint>f=n=>((n=n>>16|n<<16)&0xFF00FF00)>>8|(n&0xFF00FF)<<8;
```
**70:**
```
uint e(uint n){n=n>>16|n<<16;return(n&0xFF00FF00)>>8|(n&0xFF00FF)<<8;}
```
[Try it online!](https://tio.run/##jY5BC4JAEIXP7q9YPIQLJWOFSGteBE91Kqjrui6xYCO5axjqbzfzEB07DPPe8HjfSLOSVa3GsTEab/T0MlbdOfl1/kHjgxMiS2EMPStj01l1xDFWWC1po9FS5c0LWYd7TJIg7DGOg5DXyjY1eriANssAPsOSJOp/LiyOIz6Qb9@z0gU9Co0eI86EcdIKTVUq/1Jrq6Z3lOd2sLtGg7ucuNAKkedSFgVj/I80BLCGDWzn9ECGcXwD "C# (.NET Core) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~12~~ 10 bytes
```
3F₁‰R`})₁β
```
[Try it online!](https://tio.run/##MzBNTDJM/f/f2O1RU@Ojhg1BCbWaQNa5Tf//GxqZmViYGBsAAA "05AB1E – Try It Online") Explanation:
```
  ₁         Integer constant 256
   ‰        [Div, Mod]
    R       Reverse
     `      Flatten to stack
3F    }     Repeat 3 times
       )    Collect results
        ₁β  Convert from base 256
```
[Answer]
## JavaScript (ES6), ~~45~~ 43 bytes
```
f=(n,p=0,t=4)=>t?f(n>>>8,p*256+n%256,t-1):p
```
[Answer]
# PPC Assembly (32-bit), 8 bytes
```
endian_swap:    # WORD endian_swap(WORD)
7c 60 1c 2c     LWBRX 3,0,3
4e 80 00 20     BLR
```
How this works:
* PPC calling convention puts the first 32-bit word parameter into SP+24, and shadows that address into GPR3.
* [LWBRX](https://www.ibm.com/support/knowledgecenter/en/ssw_aix_61/com.ibm.aix.alangref/idalangref_lwbrx_lbx_lwbri_instrs.htm) takes load GPR3 (third operand) and zero-extends it (second operand) into EA, then reads 4 bytes in reverse order and stores it into GPR3 (first operand).
* GPR3 holds the return value.
* BLR returns from the function (branches to the address in the LR register)
Unfortunately there aren't any online PPC assembly emulators that I could find to demonstrate. Sorry!
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
```
žJ+₁в¦R₁β
```
[Try it online!](https://tio.run/##MzBNTDJM/f//6D4v7UdNjRc2HVoWBKTPbfr/3xAA "05AB1E – Try It Online")
-1 thanks to [Neil](https://codegolf.stackexchange.com/users/17602/neil).
Port of my Jelly answer.
[Answer]
# Befunge, ~~62~~ 61 or 49 bytes
```
0&0v!p22:/3g22/*:*82\+%*:*82+<
@.$_:28*:*%00p\28*:**00g28*:*^
```
[Try it online!](http://befunge.tryitonline.net/#code=MCYwdiFwMjI6LzNnMjIvKjoqODJcKyUqOio4Mis8CkAuJF86MjgqOiolMDBwXDI4KjoqKjAwZzI4KjoqXg&input=NDI)
This is using standard Befunge on the reference interpreter, and we thus need to account for the fact that memory cells are 8-bit signed, and correct for possible signed overflow.
On implementations with unsigned memory cells (e.g. PyFunge), or where the range is greater than 8 bits (e.g. FBBI), we can get away without those checks, saving 12 bytes.
```
0&0v!p22:/3g22/*:*82\+g<
@.$_:28*:*%00p\28*:**00^
```
[Try FBBI online!](http://befunge-93-fbbi.tryitonline.net/#code=MCYwdiFwMjI6LzNnMjIvKjoqODJcK2c8CkAuJF86MjgqOiolMDBwXDI4KjoqKjAwXg&input=NDI)  
[Try PyFunge online!](http://befunge-93-pyfunge.tryitonline.net/#code=MCYwdiFwMjI6LzNnMjIvKjoqODJcK2c8CkAuJF86MjgqOiolMDBwXDI4KjoqKjAwXg&input=NDIK)
Although note that PyFunge has a bug processing integer input, so when testing on TIO you need to follow the number in the input field with a space or line break.
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~12~~ 10 bytes
```
7Y%1Z%P7Z%
```
[Try it online!](https://tio.run/##y00syfn/3zxS1TBKNcA8SvX/f0MzCwtTS1MjAA) Or [verify all test cases](https://tio.run/##DcgpEsNADAVRrnsMl752ngMEhMQo5jbz/ScCXdX17vO59m/nd8mx3nms/fpsJiEDCWoKK9ORqPJ2ULLFQII01Rvl3mTMnVownkW4Suko2joS7X8).
### Explanation
```
        % Implicitly input a number, read as a double
7Y%     % Cast to uint32
1Z%     % Convert to uint8 without changing underlying data. The result is 
        % an array of four uint8 numbers, each corresponding to a byte of
        % the original number's representation 
P       % Flip array
7Z%     % Convert back to uint32 without changing underlying data. The array
        % of four uint8 numbers is interpreted as one uint32 number.
        % Implicitly display
```
[Answer]
# C, 50 bytes
```
#define f(i) (i>>24|i>>8&65280|(i&65280)<<8|i<<24)
```
[Try it online!](https://tio.run/##VYxBi4MwFITv/oqH0iVPbFFxF6HBX1D2Vnro7iEbE/sgTUtMvNT9602VPe1lmPlmGLkdpIwZWWlCr4CPvjf0s7t0yT9GtwXFrFearALNCIFR19XNvGj79vFet@XM6M8g5@1MnNcNRrIeroIsW41wgyxAXoSDPF/ChPBIAIA0WyvooEK4u2WqWboJXzYtNGPBjjRY1ePonb8Fs26nc/VdfB4Ph6IqEXG/vjjlg7NQ7pPfGJv6KbURwxi3J2HMCw "C (gcc) – Try It Online")
To be more portable, I didn't want to use any functions that aren't in ANSI C. :-)
Like @hvd, I also cribbed Polynomial's answer. Due to C's operator precedence, I had to add parentheses around the third term.
[Answer]
# JavaScript (ES6), ~~51~~ 45 bytes
*Saved 6 bytes with @Neil's help*
```
n=>(n>>>24|n>>8&65280|(n&65280)<<8|n<<24)>>>0
```
### Test cases
```
let f=
n=>(n>>>24|n>>8&65280|(n&65280)<<8|n<<24)>>>0
console.log(f(0         )) // -> 0
console.log(f(1         )) // -> 16777216
console.log(f(42        )) // -> 704643072
console.log(f(128       )) // -> 2147483648
console.log(f(16885952  )) // -> 3232235777
console.log(f(704643072 )) // -> 42
console.log(f(3735928559)) // -> 4022250974
console.log(f(4009738240)) // -> 12648430
console.log(f(4026531839)) // -> 4294967279
console.log(f(4294967295)) // -> 4294967295
```
[Answer]
# J, 16 bytes
```
|.&.((4#256)#:])
```
[Try it online!](https://tio.run/##VY@xCsMwDET3fIUhUJIl2CfJsgpZ@gGdunYqCaVLh3Tsv7shdgLdfHfSPfmV8@zGwX2H09B13EJi357vfdNcL4O7TctnaabH8@28G93sfBFhEyGqKkIsHmMz1XNk8oo6ibTZCKycKHLa/fW5zm0he29KCbzXx5TEpBQSCCBZUSU8AGW1ckhJDEnEaiMAWVu5HncQyuWVvoeIQiFR3YWxRYXa/rGiTf5ik5x/)
Working on shortening the right-hand expression. I think I can shave off a few bytes by making this work with a beta J version. I swear I saw on here that you can end a train with a noun in a new beta version...
# Explanation
```
|.&.((4#256)#:])
    ((4#256)#:])  Convert to 4 two-byte blocks
            #:      Debase to
      4#256         4 digits base 256
  &.              Apply right function, left function, then inverse of right
|.                Reverse digits
```
Convert to 4 digits base 256, reverse the digits, then convert back to decimal. Basically, perform the algorithm that is provided in the OP. This is perhaps the one time where it's helpful that J's mixed base conversion requires you to specify the number of digits, although it would be 2 fewer bytes if I could end the train in a noun (`(#:~4#256)` instead).
[Answer]
# Excel VBA, ~~103~~ 92 Bytes
Anonymous VBE immediate window function that takes input from range `[A1]` converts to hex, reverses bytes, and outputs to the VBE immediate window
```
h=[Right(Rept(0,8)&Dec2Hex(A1),8)]:For i=0To 3:s=s+Mid(h,7-2*i,2):Next:[B1]=s:?[Hex2Dec(B1)]
```
[Answer]
# [CP-1610](https://en.wikipedia.org/wiki/General_Instrument_CP1600) assembly, 6 DECLEs = 8 bytes
This code is intended to be run on an [Intellivision](https://en.wikipedia.org/wiki/Intellivision).
A CP-1610 opcode is encoded with a 10-bit value, known as a 'DECLE'. This function is 6 DECLEs long, starting at $480C and ending at $4811.
The CP-1610 has 16-bit registers, so we're using two of them (R0 and R1) to store a 32-bit value.
```
                               ROMW  10           ; use 10-bit ROM
                               ORG   $4800        ; start program at address $4800
                               ;; example call
4800  0001                     SDBD               ; load 0xDEAD into R0
4801  02B8 00AD 00DE           MVII  #$DEAD, R0
4804  0001                     SDBD               ; load 0xBEEF into R1
4805  02B9 00EF 00BE           MVII  #$BEEF, R1
4808  0004 0148 000C           CALL  swap32       ; call our function
480B  0017                     DECR  PC           ; loop forever
                               ;; swap32 function
                       swap32  PROC
480C  0040                     SWAP  R0           ; 16-bit SWAP of R0
480D  0041                     SWAP  R1           ; 16-bit SWAP of R1
480E  01C1                     XORR  R0, R1       ; exchange R0 and R1
480F  01C8                     XORR  R1, R0       ; using 3 consecutive eXclusive OR
4810  01C1                     XORR  R0, R1
4811  00AF                     JR    R5           ; return
                               ENDP
```
### Execution dump
```
 R0   R1   R2   R3   R4   R5   R6   R7    CPU flags  instruction
 ------------------------------------------------------------------
 0000 4800 0000 0000 01FE 1041 02F1 4800  ------iq   SDBD
 0000 4800 0000 0000 01FE 1041 02F1 4801  -----D-q   MVII #$DEAD,R0
 DEAD 4800 0000 0000 01FE 1041 02F1 4804  ------iq   SDBD
 DEAD 4800 0000 0000 01FE 1041 02F1 4805  -----D-q   MVII #$BEEF,R1
[DEAD BEEF]0000 0000 01FE 1041 02F1 4808  ------iq   JSR  R5,$480C
 DEAD BEEF 0000 0000 01FE 480B 02F1 480C  ------iq   SWAP R0
 ADDE BEEF 0000 0000 01FE 480B 02F1 480D  S------q   SWAP R1
 ADDE EFBE 0000 0000 01FE 480B 02F1 480E  S------q   XORR R0,R1
 ADDE 4260 0000 0000 01FE 480B 02F1 480F  ------iq   XORR R1,R0
 EFBE 4260 0000 0000 01FE 480B 02F1 4810  S-----iq   XORR R0,R1
[EFBE ADDE]0000 0000 01FE 480B 02F1 4811  S-----iq   MOVR R5,R7
 EFBE ADDE 0000 0000 01FE 480B 02F1 480B  ------iq   DECR R7
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 10 bytes
```
@swapbytes
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en99@huDyxIKmyJLX4f6JtaWZeibGRhomRpjVXmkai5n8A "Octave – Try It Online")
This may be the first time that Octave has the exact same score as its golfing derivative, MATL. Of course, in this case, it's Octave that has the built-in, rather than MATL, making it a lot easier.
Defines a handle to the built-in `swapbytes`, which takes any data type, swaps the endianness and outputs the result. In this case, the input is a 32-bit unsigned integer.
[Answer]
# C#, ~~44~~ 36 bytes
```
n=>n>>24|n>>8&65280|n&65280<<8|n<<24
```
[Try it online!](https://tio.run/##jY7NCoJAFIXXzlNcXISCyWQWkqMboVWtCmo7jkMM2JWcMQr12c2MoGWb8wOHjyP0XFS1HIZGK7zA4amNvMbkt/k7hbeYEFFyreEotcmm1BJLG26UgG2DgjUKjQdvTUFCApikmKZB2I0azdarIKIdfpyxqEPGgnCkfhn3ShWw5wodl1gj2soq1FUp/VOtjBwvSMdu6eYc9bYH0qEPzvNciKJw3fiPNV3QgC5pOK170g/DCw)
This was originally based on [Polynomial's C# answer](https://codegolf.stackexchange.com/a/149061/16385), who suggested I post a new answer with my improvements on it, but the approach taken [in Arnauld's JavaScript answer](https://codegolf.stackexchange.com/a/149058/16385) turned out to be even shorter in C#.
[Answer]
# [R](https://www.r-project.org/), 86 bytes
I thought there was already an answer (or two) in R for this question, but I must have been mistaken or they had the same issues that I had with R not doing signed ints. That issue took out any builtins that could have helped. I tried the 256 base conversion, but it ended up being to long, but I think there is still room for someone smarter than me to do that. Then I ended up with the following which it a base 2 conversion swapping the order in a recursive function.
```
f=function(x,y=0,i=31)'if'(i+1,f(x-(2^i*z),y+(2^((3-i%/%8)*8+i%%8)*(z=2^i<=x)),i-1),y)
```
[Try it online!](https://tio.run/##VY9LbsMgEIb3PUU2VpgYKzAPGKRwlW4qIbFJpaqRnFzexTi1EjYDfP8Dfpal5HK7fv3W76uZ7T07WzN5ONZyNHX0tph5MvhZTw@w97HtjKGpDudB4aRjHdZpHrkpLnkGsHXyTQhLMQ4O@8r54D6K8e9XPsQY0YdGGOGVRMeByUVcTajwgtBzZKXA2lmbTQgbY@dSJEXuZUFVkuCTERIiSWtsbM@Hzbf2UCRJqCIJtixElJbH6/P24M7@azvBIOSVni5MnELEmPqntkOSN5Zk@QM "R – Try It Online")
```
f=function(x,y=0,i=31)       # set up the function and initial values
  'if'(i+1,                  # test for i >= 0
    f(                       # recursively call the function
      x-(2^i*z),             # remove 2^i from x when 2^i <= x
      y+(2^                  # add to y 2 to the power of
        ((3-i%/%8)*8+i%%8)   # calc to swap the order of the bytes
        *(z=2^i<=x)),        # when 2^i <= x
      i-1),                  # decrement i
   y)                        # return y
```
[Answer]
# [R](https://www.r-project.org/), 41 bytes
```
function(n)n%/%256^(0:3)%%256%*%256^(3:0)
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/TyNPM09VX9XI1CxOw8DKWFMVxFTVgggYWxlo/k/TMDSy0PwPAA "R – Try It Online")
[Verify all test cases!](https://tio.run/##JchJCgIxEEDRq7gJJFJipYakqvEsgjQEBImNw8LTx4iLD5/3GG13Ooz27uvreu@xpx6OgbScIy6cwm/D/g@8YBrPy7bdPnGNCBmEIJPNipjwlGKmrgQVpUyoBFxZnUzVQRC9spHgXCrK2XgquXip5JqgpfEF)
Uses a base-256 conversion as MickyT suggested [here](https://codegolf.stackexchange.com/a/149297/67312). R does not have unsigned 32-bit integers, nor does it have 64-bit integers. This prevents us from using bitwise operations but this approach (and likely MickyT's) is probably still shorter since R's bitwise operators are quite verbose.
Utilizes number 4 of [this tip](https://codegolf.stackexchange.com/a/138046/67312), taking into account that we're never getting a number as large as `256^4`.
`n%/%256^(0:3)%%256` extracts the bytes, and `%*%`, the matrix product, is the dot product in this situation, with `256^(3:0)` effecting the reversed order of bytes. `%*%` will return a 1x1 `matrix` containing the endian-reversed value.
[Answer]
# ARM machine language Linux, 8 bytes
```
0:       e6bf0f30       rev     r0, r0
4:       e12fff1e       bx      lr
```
To try this yourself, compile and run the following on a Raspberry Pi or Android device running GNUroot
```
#include<stdio.h>
#define f(x) ((unsigned int(*)(unsigned int))"0\xf\xbf\xe6\x1e\xff/\xe1")(x)
int main(){
  printf( "%u %u\n", 0, f(0) );
  printf( "%u %u\n", 1, f(1) );
  printf( "%u %u\n", 42, f(42) );
  printf( "%u %u\n", 128, f(128) );
  printf( "%u %u\n", 16885952, f(16885952) );
  printf( "%u %u\n", 704643072, f(704643072) );
  printf( "%u %u\n", 3735928559U, f(3735928559U) );
  printf( "%u %u\n", 4009738240U, f(4009738240U) );
  printf( "%u %u\n", 4026531839U, f(4026531839U) );
  printf( "%u %u\n", 4294967295U, f(4294967295U) );
}
```
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, 21 bytes
```
$_=unpack V,pack N,$_
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3rY0ryAxOVshTAdM@emoxP//b2hmbm5uZGj2L7@gJDM/r/i/bgEA "Perl 5 – Try It Online")
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 72+31=103 bytes
```
m=>BitConverter.ToUInt32(BitConverter.GetBytes(m).Reverse().ToArray(),0)
```
[Try it online!](https://tio.run/##jZFfS8MwFMWfzafIYwuzpDf/qR04UREUxCk@ly5IYEu1ySZj7LPXWDfm3vISuJfzyzknaf1l2/VmWHvrPvB864NZVej/VDxa91Whdtl4j593yIcm2BbfrV17tbYuTPDvOcXz7@bz1i1s45yJyhoPq3o6s@GmcxvTB9MXr93bgwsUsrPtvQmzbTA@W@XFi4lLb7I8aq/7vtlm@YTkQ4WOrpvOLvBTY12Wox26iLf4bmmK994GE3Oa7DxFRnJc15jkVYK2HLWlkFJCKZIQBiMjCROMEglpPqBGCkommaKCqUQsKqPLyDJCtKQKWGI1oRTX/C8tBQpAeayZxJ7KjcZpHamkXIPiXB/iAgCPkVnas57ajV9ybJ7GguC0VPTgDJppIUHqxA/9k2t@RsexQnu0H34A "C# (.NET Core) – Try It Online")
+31 for `using System;using System.Linq;`
I was hoping to use `Array.Reverse` inline, but it wasn't to be (see alternative below).
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 87+13=100 bytes
```
m=>{var a=BitConverter.GetBytes(m);Array.Reverse(a);return BitConverter.ToUInt32(a,0);}
```
[Try it online!](https://tio.run/##jZFRa8MgFIWf56/wMYGuJFeNSpbCOrYx2KCsG3uWVIbQmqGmo5T@9sylLaVvvgji@Tzn3Nv627Zzeui9sd94ufNBb2rUrpX3eLFHPqhgWvzU2/auNzZM8P85w8tf9fNoV0ZZq6OywcOmme23ymHVzE146OxWu6Dd9FmH@S5on23y@t45tZu@6/jkdaby2unQO4uvgI/u88UGApmaFHl9GGp0DrHtzAq/KWOzHO3RTUR8t9bTL2eCfjVWZ9ehsiLHTYPjJwnactSWFeccyioJoTAyvKAVJQWHNB8QIwUl5VSQiopELCqjy8jSopCcCKCJ1SohmGTHtAQIAGGxZhJ7KTcap3UknDAJgjF5igsALEamaWO9tBtXcm6exkLFSCnIyRkklRUHLhMXepRLdkXHa40O6DD8AQ "C# (.NET Core) – Try It Online")
+13 for `using System;`
This solution care of @JeppeStigNielsen; removing the restriction of having everything inline saved 3 bytes.
[Answer]
# [REXX](http://www.rexx.org/), 42 bytes
```
say c2d(left(reverse(d2c(arg(1))),4,'0'x))
```
[Try it online!](https://tio.run/##K0qtqPj/vzixUiHZKEUjJzWtRKMotSy1qDhVI8UoWSOxKF3DUFNTU8dER91AvUJT8////@YGJmYmxgbmRgA "Rexx (Regina) – Try It Online")
Ungolfed:
```
n=arg(1) -- take n as argument
n=d2c(n) -- convert from decimal to character (bytes)
n=reverse(n) -- reverse characters
n=left(n,4,'0'x) -- extend to four bytes, padding with zeros
n=c2d(n) -- convert from bytes to decimal again
say n -- output result
```
[Answer]
## Swift, 28 bytes
```
{(n:UInt32)in n.byteSwapped}
```
[Answer]
# [Perl 5](https://www.perl.org/), 27 bytes
```
say hex unpack H8,pack I,<>
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVIhI7VCoTSvIDE5W8HDQgdMe@rY2P3/b2JkaWJpZm5kafovv6AkMz@v@L@ur6megaEBAA "Perl 5 – Try It Online")
]