Learning Solidity : Tutorial 12 Functional Assembly

Homepage of solidity : https://solidity.readthedocs.io/en/develop/
Remix : http://remix.ethereum.org
Source code : https://github.com/willitscale/learning-solidity

If you would like to donate some Ethereum my wallet is: 0xC8c8c3Fae80e3eD236970e1C93AcF5B91D0993e2
Many thanks!

Solidity Assembly: http://solidity.readthedocs.io/en/develop/assembly.html

Comments

BitShortener says:

Working with Hex values in this way are new to me.. I get why uint is 0x20, but Why would we mstore(add(_ptr, 0x20), _v) then return(_ptr, 0x40) for a byte array ? What about the first 32 bytes? I lose you around 15:30 onward

edit: length of the array followed by the sequential values… so if the array contains one uint then the length is 0x20, then the values (which would be one uint) would be from 0x20 to 0x40?

id test says:

Hi Sir, can you teach some knowledge about how to update the exist smart contract in Ethereum , thank you!

f j says:

Great tutorial sir keep up the good work

What's Solidity says:

Also, I was right with returning the bytes array at the end I just forgot to compile it /facepalm…

function functionalReturn() returns (bytes) {
assembly {
let ptr := add(msize(),1)
mstore(ptr, 1)
mstore(add(ptr, 0x20), 15)
return(ptr, 0x40)
}
}

What's Solidity says:

Sorry for sound levels, I switched the microphone around and it lowered my input volume.

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours