A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4751

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876

Re: Bubblesort - mcpaste

Re: Bubblesort

Von anonymous, 3 Jahre vorher, geschrieben in ARM Assembler, aufgerufen 900 mal. Dieser Paste ist eine Antwort auf Bubblesort von MC_J - Unterschiede zeigen
URL https://mcpaste.de/view/cdc508fa Einbetten
Paste herunterladen oder Rohtext anzeigen
  1. # this subroutine bubble sorts vectors of words
  2. #
  3. # inputs
  4. #   r0 - start of vector
  5. #   r1 - number of elements to sort
  6. #
  7. # no outputs
  8. #
  9. # locals
  10. #   r4 - current pointer
  11. #   r5 - inner counter
  12. #   r6 - keep_going flag
  13. #   r7 - first element
  14. #   r8 - second element
  15.  
  16. .equ datum_size,4
  17. .globl _bubble
  18. .text
  19. _bubble:
  20.         stmfd   sp!, {r4, r5, r6, r7, r8, lr}   @ save variables to stack
  21.         cmp     r1, #1                          @ number of elements must be > 1
  22.         ble     end_outer                       @ stop if nothing to do
  23.  
  24.         sub     r5, r1, #1                      @ need n-1 comparisons
  25.         mov     r4, r0                          @ initialise current pointer
  26.         mov     r6, #0                          @ this register set when we swap
  27.  
  28. loop_start:
  29.         ldr     r7, [r4], #datum_size           @ load one element
  30.         ldr     r8, [r4]                        @ and next one
  31.         cmp     r7, r8                          @ compare them
  32.         ble     no_swap                         @ branch if second greater
  33.  
  34.         mov     r6, #1                          @ set keep_going flag
  35.         sub     r4, r4, #datum_size             @ reset pointer to first element
  36.         swp     r8, r8, [r4]                    @ exchange value in r8 and address in r4
  37.         str     r8, [r4, #datum_size]!          @ store new r8 to incremented address
  38. no_swap:
  39.         subs    r5, r5, #1                      @ decrement counter
  40.         bne     loop_start                      @ and restart loop if more needed
  41.  
  42. end_inner:
  43.         cmp     r6, #0                          @ check keep_going flag
  44.         beq     end_outer                       @ and leave if not set
  45.  
  46.         mov     r6, #0                          @ clear keep_going flag
  47.         mov     r4, r0                          @ reset pointer
  48.         sub     r5, r1, #1                      @ reset counter
  49.         b       loop_start                      @ start another iteration
  50.  
  51. end_outer:
  52.         ldmfd   sp!, {r4, r5, r6, r7, r8, pc}   @ restore state from stack and leave subroutime

Antwort auf "Re: Bubblesort"

Hier kannst Du auf den Paste von oben antworten

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: database/DB_driver.php

Line Number: 1876