11 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for ShiftLeft

This will take a value in EAX or AX, convert to ASCII hex with optional padding and upper or lower case This example would yield "---fc103a" push word 0x222d ; 32 bit conversion, padd output with '-' push word ASCPntr ; Pointer to end of conversion buffer push 0xfc103a call …

0
401
Member Avatar for jkon

Hello , today I was developing a short url system and I created this class to help me encode / decode integer (id) to small string. That way for example “Ac” means 3674 . Because I believe that it may be helpful to others too I share it here. Notice …

Member Avatar for diafol
2
3K
Member Avatar for TrustyTony

Here is slow brute force way to find the largest palindromic product of three digit integers. You could do loop and break out of it if you go under the smaller number (the second one) of best solution found so far to be more efficient etc.

Member Avatar for hughesadam_87
0
544
Member Avatar for TrustyTony

Sometimes we want to tackle some problem specifying properties of sequence of numbers consisting the integer. Then it is usefull to have function to join many integers to make a long integer. Most efficient way for tight loops is to stay in integers domain and not go through the string …

Member Avatar for TrustyTony
0
292
Member Avatar for Gribouillis

These two functions compute the orders of the lowest bit and the highest bit set in the binary representation of an integer. I expect them to handle securely very large integer values.

Member Avatar for Gribouillis
1
2K
Member Avatar for TrustyTony

The need for efficient storing of IP numbers came up in discussion thread. With help of this conversion to/from the 32 bit numbers that IP numbers (the old ones) represent I could push the time of finding unique IP numbers from 10 million random numbers down to under two minutes …

Member Avatar for mrkbbk
0
803
Member Avatar for TrustyTony

This function I did to improve calculator program by eliminating problems with Pythons problem of dividing integer with integer and giving integer division result.

Member Avatar for TrustyTony
0
392
Member Avatar for ddanbe
Member Avatar for ddanbe
2
986
Member Avatar for naveenreddy61

the code takes each character and stores where and how many times a roman numeral appears and the assess the integer. this is my first code im posting. anything to make the code better is most welcome. roman numeral refers to M=1000 D=500 C=100 L=50 X=10 V=5 I=1 and uses …

Member Avatar for WaltP
0
897
Member Avatar for Dave Sinkula

This is a [inlinecode]strtol[/inlinecode] version of [url=http://www.daniweb.com/code/snippet353.html] Read an Integer from the User, Part 2[/url].

Member Avatar for anthonytan
0
550
Member Avatar for William Hemsworth

Here's a function that manually converts an integer to any base between 2 and 36, the parameter list is: [CODE]void toBase( int value, // Integer value to convert char *target, // Pointer to a large enough buffer int base, // Base (from 2 to 36) int fixedDigitCount // The minimum …

Member Avatar for William Hemsworth
0
200

The End.