Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (9)
Tags (1)
master
rel-3-2
drm
dev-3-4
complex-scripts
tmp-3-2-2
dev-3-2-2
rel-3-0
64b
ver-4-0-0
master
Branches (9)
Tags (1)
master
rel-3-2
drm
dev-3-4
complex-scripts
tmp-3-2-2
dev-3-2-2
rel-3-0
64b
ver-4-0-0
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (9)
Tags (1)
master
rel-3-2
drm
dev-3-4
complex-scripts
tmp-3-2-2
dev-3-2-2
rel-3-0
64b
ver-4-0-0
MiniGUI
/
src
/
include
/
inline.h
MiniGUI
/
src
/
include
/
inline.h
inline.h 14.00 KB
Copy Edit Raw Blame History
Vincent Wei authored 2019年07月15日 14:17 +08:00 . prepend excpetion list statement
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
/*
** inline.h: Some inline functions.
**
** Create date: 1999年4月21日
*/
#ifndef GUI_INLINE_H
#define GUI_INLINE_H
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if defined(__GNUC__) && defined(i386)
#define ASM_memset2(s, c, count) \
do { \
int eax, edi, ecx; \
__asm__ __volatile__ ( \
"cld\n\t" \
"rep\n\t" \
"stosw" \
: "=&D" (edi), "=&a" (eax), "=&c" (ecx) \
: "0"(s), "1"(c), "2"(count) \
: "memory"); \
} while (0)
#define ASM_memset4(s, c, count) \
do { \
int eax, edi, ecx; \
__asm__ __volatile__ ( \
"cld\n\t" \
"rep\n\t" \
"stosl" \
: "=&D" (edi), "=&a" (eax), "=&c" (ecx) \
: "0"(s), "1"(c), "2"(count) \
: "memory"); \
} while (0)
#define ASM_memxorset(s, c, n) \
do { \
int ecx, edx, esi, edi; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsb\n\t" \
"xorb %%dl, %%al\n\t" \
"stosb\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx), "=&d" (edx) \
: "0" (s), "1" (s), "2" (n), "3" (c) \
: "al"); \
} while (0)
#define ASM_memxorset2(s, c, n) \
do { \
int ecx, edx, esi, edi; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsw\n\t" \
"xorw %%dx, %%ax\n\t" \
"stosw\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx), "=&d" (edx) \
: "0" (s), "1" (s), "2" (n), "3" (c) \
: "ax"); \
} while (0)
#define ASM_memxorset4(s, c, n) \
do { \
int ecx, edx, esi, edi; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsl\n\t" \
"xorl %%edx, %%eax\n\t" \
"stosl\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx), "=&d" (edx) \
: "0" (s), "1" (s), "2" (n), "3" (c) \
: "eax"); \
} while (0)
#define ASM_memandset4(s, c, n) \
do { \
int ecx, edx, esi, edi; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsl\n\t" \
"andl %%edx, %%eax\n\t" \
"stosl\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx), "=&d" (edx) \
: "0" (s), "1" (s), "2" (n), "3" (c) \
: "eax"); \
} while (0)
#define ASM_memorset4(s, c, n) \
do { \
int ecx, edx, esi, edi; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsl\n\t" \
"orl %%edx, %%eax\n\t" \
"stosl\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx), "=&d" (edx) \
: "0" (s), "1" (s), "2" (n), "3" (c) \
: "eax"); \
} while (0)
#define ASM_memandcpy4(dst, src, n) \
do { \
int edi, esi, ecx; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsl\n\t" \
"andl %%eax, (%%edi)\n\t" \
"addl 4,ドル %%edi\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx) \
: "0" (dst), "1" (src), "2" (n) \
: "eax"); \
} while (0)
#define ASM_memorcpy4(dst, src, n) \
do { \
int edi, esi, ecx; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsl\n\t" \
"orl %%eax, (%%edi)\n\t" \
"addl 4,ドル %%edi\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx) \
: "0" (dst), "1" (src), "2" (n) \
: "eax"); \
} while (0)
#define ASM_memxorcpy4(dst, src, n) \
do { \
int edi, esi, ecx; \
__asm__ __volatile__ ( \
"cld\n\t" \
"1:\n\t" \
"lodsl\n\t" \
"xorl %%eax, (%%edi)\n\t" \
"addl 4,ドル %%edi\n\t" \
"loop 1b\n\t" \
: "=&D" (edi), "=&S" (esi), "=&c" (ecx) \
: "0" (dst), "1" (src), "2" (n) \
: "eax"); \
} while (0)
#if 0
static inline void *
__memset4(void *s, unsigned c, size_t count)
{
__asm__ __volatile__ (
"cld\n\t"
"rep\n\t"
"stosl"
: : "a"(c), "D"(s), "c"(count)
: "cx", "di");
return s;
}
static inline void *
__memset3(void *s, int c, size_t count)
/* count is in 24-bit pixels (3 bytes per pixel) */
{
__asm__ __volatile__ (
"cmpl 8,ドル%%edx\n\t"
/* "jmp 2f\n\t" *//* debug */
"jl 2f\n\t"
"movl %%eax,%%ebx\n\t" /* eax = (low) BGR0 (high) */
"shll 24,ドル%%ebx\n\t" /* ebx = 000B */
"orl %%ebx,%%eax\n\t" /* eax = BGRB */
"movl %%eax,%%ebx\n\t"
"shrl 8,ドル%%ebx\n\t" /* ebx = GRB0 */
"movl %%ebx,%%ecx\n\t"
"shll 24,ドル%%ecx\n\t" /* ecx = 000G */
"orl %%ecx,%%ebx\n\t" /* ebx = GRBG */
"movl %%eax,%%ecx\n\t"
"shll 8,ドル%%ecx\n\t" /* ecx = 0BGR */
"movb %%bh,%%cl\n\t" /* ecx = RBGR */
"cmpl 16,ドル%%edx\n\t"
"jl 1f\n\t"
"jmp 5f\n\t"
".align 4,0x90\n\t"
"5:\n\t" /* loop unrolling */
"movl %%eax,(%%edi)\n\t" /* write BGRB */
"movl %%ebx,4(%%edi)\n\t" /* write GRBG */
"movl %%ecx,8(%%edi)\n\t" /* write RBGR */
"movl %%eax,12(%%edi)\n\t"
"movl %%ebx,16(%%edi)\n\t"
"movl %%ecx,20(%%edi)\n\t"
"movl %%eax,24(%%edi)\n\t"
"movl %%ebx,28(%%edi)\n\t"
"movl %%ecx,32(%%edi)\n\t"
"movl %%eax,36(%%edi)\n\t"
"subl 16,ドル%%edx\n\t" /* blend end-of-loop instr. */
"movl %%ebx,40(%%edi)\n\t"
"movl %%ecx,44(%%edi)\n\t"
"addl 48,ドル%%edi\n\t"
"cmpl 16,ドル%%edx\n\t"
"jge 5b\n\t"
"andl %%edx,%%edx\n\t"
"jz 4f\n\t" /* finished */
"cmpl 4,ドル%%edx\n\t"
"jl 2f\n\t" /* less than 4 pixels left */
"jmp 1f\n\t"
".align 4,0x90\n\t"
"1:\n\t"
"movl %%eax,(%%edi)\n\t" /* write BGRB */
"movl %%ebx,4(%%edi)\n\t" /* write GRBG */
"movl %%ecx,8(%%edi)\n\t" /* write RBGR */
"addl 12,ドル%%edi\n\t"
"subl 4,ドル%%edx\n\t"
"cmpl 4,ドル%%edx\n\t"
"jge 1b\n\t"
"2:\n\t"
"cmpl 0,ドル%%edx\n\t" /* none left? */
"jle 4f\n\t" /* finished */
"mov %%eax,%%ecx\n\t"
"shrl 16,ドル%%ecx\n\t" /* B in cl */
"3:\n\t" /* write last few pixels */
"movw %%ax,(%%edi)\n\t" /* write RG */
"movb %%cl,2(%%edi)\n\t" /* write B */
"addl 3,ドル%%edi\n\t"
"decl %%edx\n\t"
"jnz 3b\n\t"
"4:\n\t"
: : "a"(c), "D"(s), "d"(count)
: "ax", "bx", "cx", "dx", "di");
return s;
}
static inline void *
__memset(void *s, char c, size_t count)
{
int d0;
__asm__ (
"cld\n\t"
"cmpl 12,ドル%%edx\n\t"
"jl 1f\n\t" /* if (count >= 12) */
"movzbl %%al,%%ax\n\t"
"movl %%eax,%%ecx\n\t"
"shll 8,ドル%%ecx\n\t" /* c |= c << 8 */
"orl %%ecx,%%eax\n\t"
"movl %%eax,%%ecx\n\t"
"shll 16,ドル%%ecx\n\t" /* c |= c << 16 */
"orl %%ecx,%%eax\n\t"
"movl %%edx,%%ecx\n\t"
"negl %%ecx\n\t"
"andl 3,ドル%%ecx\n\t" /* (-s % 4) */
"subl %%ecx,%%edx\n\t" /* count -= (-s % 4) */
"rep ; stosb\n\t" /* align to longword boundary */
"movl %%edx,%%ecx\n\t"
"shrl 2,ドル%%ecx\n\t"
"rep ; stosl\n\t" /* fill longwords */
"andl 3,ドル%%edx\n" /* fill last few bytes */
"1:\tmovl %%edx,%%ecx\n\t" /* <= 12 entry point */
"rep ; stosb\n\t"
: "=&a"(d0)
: "a"(c), "D"(s), "d"(count)
: "eax", "ecx", "edx", "edi", "esi");
return s;
}
static inline void *
__memset2(void *s, short c, size_t count)
/* count is in 16-bit pixels */
/* s is assumed to be 16-bit aligned */
{
int eax, ecx, edi, edx;
__asm__ __volatile__ (
"cld\n\t"
"cmpl 12,ドル%%edx\n\t"
"jl 1f\n\t" /* if (count >= 12) */
"movzwl %%ax,%%eax\n\t"
"movl %%eax,%%ecx\n\t"
"shll 16,ドル%%ecx\n\t" /* c |= c << 16 */
"orl %%ecx,%%eax\n\t"
"movl %%edi,%%ecx\n\t"
"andl 2,ドル%%ecx\n\t" /* s & 2 */
"jz 2f\n\t"
"decl %%edx\n\t" /* count -= 1 */
"stosw\n\t" /* align to longword boundary */
"2:\n\t"
"movl %%edx,%%ecx\n\t"
"shrl 1,ドル%%ecx\n\t"
"rep ; stosl\n\t" /* fill longwords */
"andl 1,ドル%%edx\n" /* one 16-bit word left? */
"jz 3f\n\t" /* no, finished */
"1:\tmovl %%edx,%%ecx\n\t" /* <= 12 entry point */
"rep ; stosw\n\t"
"3:\n\t"
: "=&D" (edi), "=&a" (eax), "=&c" (ecx), "=&d" (edx)
: "0" (s), "1" (c), "2" (count)
: "memory");
return s;
}
static inline void *
__memcpy (void *to, const void *from, size_t n)
{
int d0;
__asm__ (
"cld\n\t"
"movl %%edi,%%ecx\n\t"
"andl 1,ドル%%ecx\n\t"
"subl %%ecx,%%edx\n\t"
"rep ; movsb\n\t" /* 16-bit align destination */
"movl %%edx,%%ecx\n\t"
"shrl 2,ドル%%ecx\n\t"
"rep ; movsl\n\t"
"testb 1,ドル%%dl\n\t"
"je 1f\n\t"
"movsb\n"
"1:\ttestb 2,ドル%%dl\n\t"
"je 2f\n\t"
"movsw\n"
"2:\n"
: "=&S"(d0)
: "d"(n), "D"((long) to), "S"((long) from)
: "eax", "ecx", "edi", "esi");
return (to);
}
static inline void *__memcpyf ( void * dest, void * src, long size )
{
__asm__ __volatile__ (
"movl %%ecx, %%eax\n\t"
"andl 0ドルxFFFFFFFC, %%ecx\n\t"
"shr 2,ドル %%ecx\n\t"
"rep; movsl\n\t"
"movl %%eax, %%ecx\n\t"
"andl 3,ドル %%ecx\n\t"
"rep; movsb\n"
: : "S" ((unsigned long)src), "D" ((unsigned long)dest), "c" (size)
: "esi", "edi", "ecx", "eax" );
return dest;
}
static inline void *__memsetf ( void * dest, char c, long size )
{
__asm__ __volatile__ (
"movl %%ecx, %%edx\n\t"
"andl 0ドルxFFFFFFFC, %%ecx\n\t"
"shr 2,ドル %%ecx\n\t"
"rep; stosl\n\t"
"movl %%edx, %%ecx\n\t"
"andl 3,ドル %%ecx\n\t"
"rep; stosb\n"
: : "D" ((unsigned long)dest), "b" ((unsigned long)c), "c" (size)
: "edi", "ecx", "eax", "edx" );
return dest;
}
#endif
#endif /* defined(__GNUC__) && defined(i386) */
#ifndef ASM_memcpy
#define ASM_memcpy memcpy
#endif
#ifndef ASM_memset
#define ASM_memset memset
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* GUI_INLINE_H */
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

MiniGUI 是一个自由软件项目。其目标是提供一个快速、稳定、跨操作系统的图形用户界面(GUI)支持系统,尤其是基于 Linux/uClinux、eCos 以及其他传统 RTOS(如 VxWorks、ThreadX、uC/OS-II、Nucleus 等)的实时嵌入式操作系统。
No labels
GPL-3.0
Use GPL-3.0
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/MicroOS/MiniGUI.git
git@gitee.com:MicroOS/MiniGUI.git
MicroOS
MiniGUI
MiniGUI
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /