Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Daniel Alejandro Maydana
practica-p1-Orga2
Commits
6d48665e
Commit
6d48665e
authored
3 months ago
by
Daniel Alejandro Maydana
Browse files
Options
Download
Email Patches
Plain Diff
arregla ej2_prefijo
parent
e61df514
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
soluciones ASM/ej2_prefijo.asm
soluciones ASM/ej2_prefijo.asm
+11
-6
soluciones C/ej2_prefijo.c
soluciones C/ej2_prefijo.c
+18
-0
No files found.
soluciones ASM/ej2_prefijo.asm
View file @
6d48665e
section
.data
CHAR_SIZE
equ
1
...
...
@@ -6,6 +5,10 @@ section .text
extern
strcpy
global
prefijo_de
global
quitar_prefijo
;rsi = char* str2
;rdi = char* str1
...
...
@@ -52,18 +55,20 @@ quitar_prefijo:
push
r9
mov
[
rbp
-
8
],
rsi
; str2
mov
[
rbp
-
16
]
rdi
; str1
mov
[
rbp
-
16
]
,
rdi
; str1
call
prefijo_de
mov
r8
,
rax
call
strlen
mov
r9
,
rax
;r8 -> longitud_prefijo
;r9 -> res_size
mov
r9
,
rax
sub
r9
,
r8
add
r9
,
1
;r8 = longitud_prefijo
;r9 = res_size
mov
rax
,
CH
AR_SIZE
imul
r9
...
...
This diff is collapsed.
Click to expand it.
soluciones C/ej2_prefijo.c
View file @
6d48665e
...
...
@@ -23,3 +23,21 @@ char* quitar_prefijo(char* str1, char* str2) {
}
// esta version modifica el str2
//void quitar_prefijo(char* str1, char* str2) {
//
// int longitud_prefijo = prefijo_de(str1, str2);
// int res_size = strlen(str2) - longitud_prefijo + 1
// str2 = realloc(str2, res_size);
//
// int i = 0;
// while (str2[longitud_prefijo] != NULL) {
// str2[i] = str2[longitud_prefijo];
// i++
// longitud_prefijo++;
// }
// str[i] = '/0'
//}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment