This repository has been archived by the owner on Nov 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reverse.c
40 lines (38 loc) · 1.82 KB
/
reverse.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Copyright © [2024] Lita Inc. All Rights Reserved.
*
* This software and associated documentation files (the “Software”) are owned by Lita Inc. and are protected by copyright law and international treaties.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to use the Software for personal, non-commercial purposes only, subject to the following conditions:
*
* 1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* 2. The Software may not be used for commercial purposes without the express written permission of Lita Inc.
*
* For inquiries regarding commercial use, please contact us at: [email protected]
*
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const unsigned EOF = 0xFFFFFFFF;
#define BUF_LEN 2048
int main() {
unsigned buf[BUF_LEN];
unsigned len = 0;
while (len < BUF_LEN) {
unsigned c = __builtin_delendum_read_advice();
if (c == EOF) {
break;
} else {
buf[len] = c;
len++;
}
}
for (unsigned i = 0; i < len / 2; i++) {
unsigned j = len - 1 - i;
unsigned tmp = buf[i];
buf[i] = buf[j];
buf[j] = tmp;
}
for (unsigned i = 0; i < len; i++) {
__builtin_delendum_write(buf[i]);
}
}