diff options
Diffstat (limited to 'semestr-4/ask/lista5/zad2.c')
-rw-r--r-- | semestr-4/ask/lista5/zad2.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/semestr-4/ask/lista5/zad2.c b/semestr-4/ask/lista5/zad2.c new file mode 100644 index 0000000..ab9cb54 --- /dev/null +++ b/semestr-4/ask/lista5/zad2.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <stdint.h> + +long puzzle2(char *rdi /* rdi */, char *rsi /* rsi */) { + char *rax = rdi; +L3: + char r9b = *rax; + char *r8 = rax + 1; + char *rdx = rsi; +L2: + char cl = *rdx; + rdx++; + if (cl == 0) { + goto L4; + } + if (cl != r9b) { + goto L2; + } + rax = r8; + goto L3; +L4: + return rax - rdi; +} + + +// funkcja sprawdza jaka jest pierwsza litera z s która nie występuje w d +// jesli wszystkie występują, to zwróci długość s. +long puzzle2_decoded(char *s /* rdi */, char *d /* rsi */) { + for (char *result = s ; ; result++) { + char first = *result; + char *crawl = d; + for (char *crawl = d; *crawl != first; crawl++) { + if (*crawl == 0) { + return result - s; + } + } + } +} + + + +int main() { + +}
\ No newline at end of file |