set.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. Include file with set operations called by the compiler
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {$define FPC_SYSTEM_HAS_FPC_SET_LOAD_SMALL}
  13. function fpc_set_load_small(l: fpc_small_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_LOAD_SMALL']; {$ifdef hascompilerproc} compilerproc; {$endif}
  14. {
  15. load a normal set p from a smallset l
  16. }
  17. var
  18. saveedi : longint;
  19. asm
  20. movl %edi,saveedi
  21. movl __RESULT,%edi
  22. movl l,%eax
  23. stosl
  24. xorl %eax,%eax
  25. movl $7,%ecx
  26. rep
  27. stosl
  28. movl saveedi,%edi
  29. end;
  30. {$define FPC_SYSTEM_HAS_FPC_SET_CREATE_ELEMENT}
  31. function fpc_set_create_element(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_CREATE_ELEMENT']; {$ifdef hascompilerproc} compilerproc; {$endif}
  32. {
  33. create a new set in p from an element b
  34. }
  35. var
  36. saveedi : longint;
  37. asm
  38. {$ifndef hascompilerproc}
  39. pushl %eax
  40. pushl %ecx
  41. {$endif not hascompilerproc}
  42. movl %edi,saveedi
  43. movl __RESULT,%edi
  44. xorl %eax,%eax
  45. movl $8,%ecx
  46. rep
  47. stosl
  48. leal -32(%edi),%eax
  49. movzbl b,%edi
  50. btsl %edi,(%eax)
  51. movl saveedi,%edi
  52. {$ifndef hascompilerproc}
  53. popl %ecx
  54. popl %eax
  55. {$endif hascompilerproc}
  56. end;
  57. {$define FPC_SYSTEM_HAS_FPC_SET_SET_BYTE}
  58. {$ifdef hascompilerproc}
  59. function fpc_set_set_byte(const source: fpc_normal_set; b : byte): fpc_normal_set;assembler; compilerproc;
  60. {
  61. add the element b to the set pointed by source
  62. }
  63. var
  64. saveesi,saveedi : longint;
  65. asm
  66. movl %edi,saveedi
  67. movl %esi,saveesi
  68. movl $8,%ecx
  69. movl source,%esi
  70. movl __RESULT,%edi
  71. rep
  72. movsl
  73. leal -32(%edi),%eax
  74. movzbl b,%edi
  75. btsl %edi,(%eax)
  76. movl saveedi,%edi
  77. movl saveesi,%esi
  78. end;
  79. {$else hascompilerproc}
  80. function fpc_set_set_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_SET_BYTE'];
  81. {
  82. add the element b to the set pointed by p
  83. }
  84. asm
  85. pushl %eax
  86. movl __RESULT,%edi
  87. movb b,%al
  88. andl $0xf8,%eax
  89. shrl $3,%eax
  90. addl %eax,%edi
  91. movb b,%al
  92. andl $7,%eax
  93. btsl %eax,(%edi)
  94. popl %eax
  95. end;
  96. {$endif hascompilerproc}
  97. {$define FPC_SYSTEM_HAS_FPC_SET_UNSET_BYTE}
  98. {$ifdef hascompilerproc}
  99. function fpc_set_unset_byte(const source: fpc_normal_set; b : byte): fpc_normal_set;assembler; compilerproc;
  100. {
  101. add the element b to the set pointed by source
  102. }
  103. var
  104. saveesi,saveedi : longint;
  105. asm
  106. movl %edi,saveedi
  107. movl %esi,saveesi
  108. movl $8,%ecx
  109. movl source,%esi
  110. movl __RESULT,%edi
  111. rep
  112. movsl
  113. leal -32(%edi),%eax
  114. movzbl b,%edi
  115. btrl %edi,(%eax)
  116. movl saveedi,%edi
  117. movl saveesi,%esi
  118. end;
  119. {$else hascompilerproc}
  120. function fpc_set_unset_byte(b : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_UNSET_BYTE']; {$ifdef hascompilerproc} compilerproc; {$endif}
  121. {
  122. suppresses the element b to the set pointed by p
  123. used for exclude(set,element)
  124. }
  125. asm
  126. pushl %eax
  127. movl __RESULT,%edi
  128. movb b,%al
  129. andl $0xf8,%eax
  130. shrl $3,%eax
  131. addl %eax,%edi
  132. movb b,%al
  133. andl $7,%eax
  134. btrl %eax,(%edi)
  135. popl %eax
  136. end;
  137. {$endif hascompilerproc}
  138. {$define FPC_SYSTEM_HAS_FPC_SET_SET_RANGE}
  139. {$ifdef hascompilerproc}
  140. function fpc_set_set_range(const orgset: fpc_normal_set; l,h : byte): fpc_normal_set;assembler; compilerproc;
  141. {
  142. adds the range [l..h] to the set pointed to by p
  143. }
  144. var
  145. saveesi,saveedi,saveebx : longint;
  146. asm
  147. movl %edi,saveedi
  148. movl %esi,saveesi
  149. movl %ebx,saveebx
  150. movzbl l,%eax // lowest bit to be set in eax
  151. movzbl h,%ebx // highest in ebx
  152. movl $8,%ecx // we have to copy 32 bytes
  153. movl __RESULT,%edi // target set address in edi
  154. movl orgset, %esi // source set address in esi
  155. cmpl %eax,%ebx // high < low?
  156. rep // copy source to dest (it's possible to do the range
  157. movsl // setting and copying simultanuously of course, but
  158. // that would result in many more jumps and code)
  159. movl %eax,%ecx // lowest also in ecx
  160. jb .Lset_range_done // if high > low, then dest := source
  161. shrl $3,%eax // divide by 8 to get starting and ending byte
  162. shrl $3,%ebx // address
  163. andb $31,%cl // low five bits of lo determine start of bit mask
  164. andl $0x0fffffffc,%eax // clear two lowest bits to get start/end longint
  165. subl $32,%edi // get back to start of dest
  166. andl $0x0fffffffc,%ebx // address * 4
  167. movl $0x0ffffffff,%edx // edx = bitmask to be inserted
  168. shll %cl,%edx // shift bitmask to clear bits below lo
  169. addl %eax,%edi // go to starting pos in set
  170. subl %eax,%ebx // are bit lo and hi in the same longint?
  171. jz .Lset_range_hi // yes, keep current mask and adjust for hi bit
  172. orl %edx,(%edi) // no, store current mask
  173. movl $0x0ffffffff,%edx // new mask
  174. addl $4,%edi // next longint of set
  175. subl $4,%ebx // bit hi in this longint?
  176. jz .Lset_range_hi // yes, keep full mask and adjust for hi bit
  177. .Lset_range_loop:
  178. movl %edx,(%edi) // no, fill longints in between with full mask
  179. addl $4,%edi
  180. subl $4,%ebx
  181. jnz .Lset_range_loop
  182. .Lset_range_hi:
  183. movb h,%cl
  184. movl %edx,%ebx // save current bitmask
  185. andb $31,%cl
  186. subb $31,%cl // cl := (31 - (hi and 31)) = shift count to
  187. negb %cl // adjust bitmask for hi bit
  188. shrl %cl,%edx // shift bitmask to clear bits higher than hi
  189. andl %edx,%ebx // combine both bitmasks
  190. orl %ebx,(%edi) // store to set
  191. .Lset_range_done:
  192. movl saveedi,%edi
  193. movl saveesi,%esi
  194. movl saveebx,%ebx
  195. end;
  196. {$else hascompilerproc}
  197. function fpc_set_set_range(l,h : byte): fpc_normal_set;assembler;[public,alias:'FPC_SET_SET_RANGE'];
  198. {
  199. adds the range [l..h] to the set pointed to by p
  200. }
  201. asm
  202. movzbl l,%eax // lowest bit to be set in eax
  203. movzbl h,%ebx // highest in ebx
  204. cmpl %eax,%ebx
  205. jb .Lset_range_done
  206. movl __RESULT,%edi // set address in edi
  207. movl %eax,%ecx // lowest also in ecx
  208. shrl $3,%eax // divide by 8 to get starting and ending byte
  209. shrl $3,%ebx // address
  210. andb $31,%cl // low five bits of lo determine start of bit mask
  211. movl $0x0ffffffff,%edx // edx = bitmask to be inserted
  212. andl $0x0fffffffc,%eax // clear two lowest bits to get start/end longint
  213. andl $0x0fffffffc,%ebx // address * 4
  214. shll %cl,%edx // shift bitmask to clear bits below lo
  215. addl %eax,%edi // go to starting pos in set
  216. subl %eax,%ebx // are bit lo and hi in the same longint?
  217. jz .Lset_range_hi // yes, keep current mask and adjust for hi bit
  218. orl %edx,(%edi) // no, store current mask
  219. movl $0x0ffffffff,%edx // new mask
  220. addl $4,%edi // next longint of set
  221. subl $4,%ebx // bit hi in this longint?
  222. jz .Lset_range_hi // yes, keep full mask and adjust for hi bit
  223. .Lset_range_loop:
  224. movl %edx,(%edi) // no, fill longints in between with full mask
  225. addl $4,%edi
  226. subl $4,%ebx
  227. jnz .Lset_range_loop
  228. .Lset_range_hi:
  229. movb h,%cl
  230. movl %edx,%ebx // save current bitmask
  231. andb $31,%cl
  232. subb $31,%cl // cl := (31 - (hi and 31)) = shift count to
  233. negb %cl // adjust bitmask for hi bit
  234. shrl %cl,%edx // shift bitmask to clear bits higher than hi
  235. andl %edx,%ebx // combine both bitmasks
  236. orl %ebx,(%edi) // store to set
  237. .Lset_range_done:
  238. end;
  239. {$endif hascompilerproc}
  240. {$define FPC_SYSTEM_HAS_FPC_SET_IN_BYTE}
  241. function fpc_set_in_byte(const p: fpc_normal_set; b: byte): boolean; assembler; [public,alias:'FPC_SET_IN_BYTE']; {$ifdef hascompilerproc} compilerproc; {$else} saveregisters; {$endif}
  242. {
  243. tests if the element b is in the set p the carryflag is set if it present
  244. }
  245. asm
  246. {$ifdef hascompilerproc}
  247. movl p,%edx
  248. movzbl b,%eax
  249. btl %eax,(%edx)
  250. {$else hascompilerproc}
  251. pushl %eax
  252. movl p,%edi
  253. movzbl b,%eax
  254. btl %eax,(%edi)
  255. popl %eax
  256. {$endif hascompilerproc}
  257. end;
  258. {$define FPC_SYSTEM_HAS_FPC_SET_ADD_SETS}
  259. {$ifdef hascompilerproc}
  260. function fpc_set_add_sets(const set1,set2: fpc_normal_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_ADD_SETS']; compilerproc;
  261. {$else hascompilerproc}
  262. procedure fpc_set_add_sets(set1,set2,dest : pointer);assembler;[public,alias:'FPC_SET_ADD_SETS'];
  263. {$endif hascompilerproc}
  264. {
  265. adds set1 and set2 into set dest
  266. }
  267. var
  268. saveesi,saveedi : longint;
  269. asm
  270. movl %edi,saveedi
  271. movl %esi,saveesi
  272. movl set1,%esi
  273. movl set2,%edx
  274. {$ifdef hascompilerproc}
  275. movl __RESULT,%edi
  276. {$else hascompilerproc}
  277. movl dest,%edi
  278. {$endif hascompilerproc}
  279. movl $8,%ecx
  280. .LMADDSETS1:
  281. lodsl
  282. orl (%edx),%eax
  283. stosl
  284. addl $4,%edx
  285. decl %ecx
  286. jnz .LMADDSETS1
  287. movl saveedi,%edi
  288. movl saveesi,%esi
  289. end;
  290. {$define FPC_SYSTEM_HAS_FPC_SET_MUL_SETS}
  291. {$ifdef hascompilerproc}
  292. function fpc_set_mul_sets(const set1,set2: fpc_normal_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_MUL_SETS']; compilerproc;
  293. {$else hascompilerproc}
  294. procedure fpc_set_mul_sets(set1,set2,dest:pointer);assembler;[public,alias:'FPC_SET_MUL_SETS'];
  295. {$endif hascompilerproc}
  296. {
  297. multiplies (takes common elements of) set1 and set2 result put in dest
  298. }
  299. var
  300. saveesi,saveedi : longint;
  301. asm
  302. movl %edi,saveedi
  303. movl %esi,saveesi
  304. movl set1,%esi
  305. movl set2,%edx
  306. {$ifdef hascompilerproc}
  307. movl __RESULT,%edi
  308. {$else hascompilerproc}
  309. movl dest,%edi
  310. {$endif hascompilerproc}
  311. movl $8,%ecx
  312. .LMMULSETS1:
  313. lodsl
  314. andl (%edx),%eax
  315. stosl
  316. addl $4,%edx
  317. decl %ecx
  318. jnz .LMMULSETS1
  319. movl saveedi,%edi
  320. movl saveesi,%esi
  321. end;
  322. {$define FPC_SYSTEM_HAS_FPC_SET_SUB_SETS}
  323. {$ifdef hascompilerproc}
  324. function fpc_set_sub_sets(const set1,set2: fpc_normal_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_SUB_SETS']; compilerproc;
  325. {$else hascompilerproc}
  326. procedure fpc_set_sub_sets(set1,set2,dest:pointer);assembler;[public,alias:'FPC_SET_SUB_SETS'];
  327. {$endif hascompilerproc}
  328. {
  329. computes the diff from set1 to set2 result in dest
  330. }
  331. var
  332. saveesi,saveedi,saveebx : longint;
  333. asm
  334. movl %edi,saveedi
  335. movl %esi,saveesi
  336. movl %ebx,saveebx
  337. movl set1,%esi
  338. movl set2,%ebx
  339. {$ifdef hascompilerproc}
  340. movl __RESULT,%edi
  341. {$else hascompilerproc}
  342. movl dest,%edi
  343. {$endif hascompilerproc}
  344. movl $8,%ecx
  345. .LMSUBSETS1:
  346. lodsl
  347. movl (%ebx),%edx
  348. notl %edx
  349. andl %edx,%eax
  350. stosl
  351. addl $4,%ebx
  352. decl %ecx
  353. jnz .LMSUBSETS1
  354. movl saveedi,%edi
  355. movl saveesi,%esi
  356. movl saveebx,%ebx
  357. end;
  358. {$define FPC_SYSTEM_HAS_FPC_SET_SYMDIF_SETS}
  359. {$ifdef hascompilerproc}
  360. function fpc_set_symdif_sets(const set1,set2: fpc_normal_set): fpc_normal_set;assembler;[public,alias:'FPC_SET_SYMDIF_SETS']; compilerproc;
  361. {$else hascompilerproc}
  362. procedure fpc_set_symdif_sets(set1,set2,dest:pointer);assembler;[public,alias:'FPC_SET_SYMDIF_SETS'];
  363. {$endif hascompilerproc}
  364. {
  365. computes the symetric diff from set1 to set2 result in dest
  366. }
  367. var
  368. saveesi,saveedi : longint;
  369. asm
  370. movl %edi,saveedi
  371. movl %esi,saveesi
  372. movl set1,%esi
  373. movl set2,%edx
  374. {$ifdef hascompilerproc}
  375. movl __RESULT,%edi
  376. {$else hascompilerproc}
  377. movl dest,%edi
  378. {$endif hascompilerproc}
  379. movl $8,%ecx
  380. .LMSYMDIFSETS1:
  381. lodsl
  382. xorl (%edx),%eax
  383. stosl
  384. addl $4,%edx
  385. decl %ecx
  386. jnz .LMSYMDIFSETS1
  387. movl saveedi,%edi
  388. movl saveesi,%esi
  389. end;
  390. {$define FPC_SYSTEM_HAS_FPC_SET_COMP_SETS}
  391. function fpc_set_comp_sets(const set1,set2: fpc_normal_set): boolean;assembler;[public,alias:'FPC_SET_COMP_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  392. {
  393. compares set1 and set2 zeroflag is set if they are equal
  394. }
  395. var
  396. saveesi,saveedi : longint;
  397. asm
  398. movl %edi,saveedi
  399. movl %esi,saveesi
  400. movl set1,%esi
  401. movl set2,%edi
  402. movl $8,%ecx
  403. .LMCOMPSETS1:
  404. movl (%esi),%eax
  405. movl (%edi),%edx
  406. cmpl %edx,%eax
  407. jne .LMCOMPSETEND
  408. addl $4,%esi
  409. addl $4,%edi
  410. decl %ecx
  411. jnz .LMCOMPSETS1
  412. { we are here only if the two sets are equal
  413. we have zero flag set, and that what is expected }
  414. .LMCOMPSETEND:
  415. {$ifdef hascompilerproc}
  416. seteb %al
  417. {$endif hascompilerproc}
  418. movl saveedi,%edi
  419. movl saveesi,%esi
  420. end;
  421. {$define FPC_SYSTEM_HAS_FPC_SET_CONTAINS_SET}
  422. function fpc_set_contains_sets(const set1,set2: fpc_normal_set): boolean;assembler;[public,alias:'FPC_SET_CONTAINS_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  423. {
  424. on exit, zero flag is set if set1 <= set2 (set2 contains set1)
  425. }
  426. var
  427. saveesi,saveedi : longint;
  428. asm
  429. movl %edi,saveedi
  430. movl %esi,saveesi
  431. movl set1,%esi
  432. movl set2,%edi
  433. movl $8,%ecx
  434. .LMCONTAINSSETS1:
  435. movl (%esi),%eax
  436. movl (%edi),%edx
  437. andl %eax,%edx
  438. cmpl %edx,%eax {set1 and set2 = set1?}
  439. jne .LMCONTAINSSETEND
  440. addl $4,%esi
  441. addl $4,%edi
  442. decl %ecx
  443. jnz .LMCONTAINSSETS1
  444. { we are here only if set2 contains set1
  445. we have zero flag set, and that what is expected }
  446. .LMCONTAINSSETEND:
  447. {$ifdef hascompilerproc}
  448. seteb %al
  449. {$endif hascompilerproc}
  450. movl saveedi,%edi
  451. movl saveesi,%esi
  452. end;
  453. {$ifdef LARGESETS}
  454. procedure fpc_largeset_set_word(p : pointer;b : word);assembler;[public,alias:'FPC_LARGESET_SET_WORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
  455. {
  456. sets the element b in set p works for sets larger than 256 elements
  457. not yet use by the compiler so
  458. }
  459. asm
  460. pushl %eax
  461. movl p,%edi
  462. movw b,%ax
  463. andl $0xfff8,%eax
  464. shrl $3,%eax
  465. addl %eax,%edi
  466. movb 12(%ebp),%al
  467. andl $7,%eax
  468. btsl %eax,(%edi)
  469. popl %eax
  470. end;
  471. procedure fpc_largeset_in_word(p : pointer;b : word);assembler;[public,alias:'FPC_LARGESET_IN_WORD']; {$ifdef hascompilerproc} compilerproc; {$endif}
  472. {
  473. tests if the element b is in the set p the carryflag is set if it present
  474. works for sets larger than 256 elements
  475. }
  476. asm
  477. pushl %eax
  478. movl p,%edi
  479. movw b,%ax
  480. andl $0xfff8,%eax
  481. shrl $3,%eax
  482. addl %eax,%edi
  483. movb 12(%ebp),%al
  484. andl $7,%eax
  485. btl %eax,(%edi)
  486. popl %eax
  487. end;
  488. procedure fpc_largeset_add_sets(set1,set2,dest : pointer;size : longint);assembler;[public,alias:'FPC_LARGESET_ADD_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  489. {
  490. adds set1 and set2 into set dest size is the number of bytes in the set
  491. }
  492. asm
  493. movl set1,%esi
  494. movl set2,%ebx
  495. movl dest,%edi
  496. movl size,%ecx
  497. .LMADDSETSIZES1:
  498. lodsl
  499. orl (%ebx),%eax
  500. stosl
  501. addl $4,%ebx
  502. decl %ecx
  503. jnz .LMADDSETSIZES1
  504. end;
  505. procedure fpc_largeset_mul_sets(set1,set2,dest : pointer;size : longint);assembler;[public,alias:'FPC_LARGESET_MUL_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  506. {
  507. multiplies (i.E. takes common elements of) set1 and set2 result put in
  508. dest size is the number of bytes in the set
  509. }
  510. asm
  511. movl set1,%esi
  512. movl set2,%ebx
  513. movl dest,%edi
  514. movl size,%ecx
  515. .LMMULSETSIZES1:
  516. lodsl
  517. andl (%ebx),%eax
  518. stosl
  519. addl $4,%ebx
  520. decl %ecx
  521. jnz .LMMULSETSIZES1
  522. end;
  523. procedure fpc_largeset_sub_sets(set1,set2,dest : pointer;size : longint);assembler;[public,alias:'FPC_LARGESET_SUB_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  524. asm
  525. movl set1,%esi
  526. movl set2,%ebx
  527. movl dest,%edi
  528. movl size,%ecx
  529. .LMSUBSETSIZES1:
  530. lodsl
  531. movl (%ebx),%edx
  532. notl %edx
  533. andl %edx,%eax
  534. stosl
  535. addl $4,%ebx
  536. decl %ecx
  537. jnz .LMSUBSETSIZES1
  538. end;
  539. procedure fpc_largeset_symdif_sets(set1,set2,dest : pointer;size : longint);assembler;[public,alias:'FPC_LARGESET_SYMDIF_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  540. {
  541. computes the symetric diff from set1 to set2 result in dest
  542. }
  543. asm
  544. movl set1,%esi
  545. movl set2,%ebx
  546. movl dest,%edi
  547. movl size,%ecx
  548. .LMSYMDIFSETSIZE1:
  549. lodsl
  550. movl (%ebx),%edx
  551. xorl %edx,%eax
  552. stosl
  553. addl $4,%ebx
  554. decl %ecx
  555. jnz .LMSYMDIFSETSIZE1
  556. end;
  557. procedure fpc_largeset_comp_sets(set1,set2 : pointer;size : longint);assembler;[public,alias:'FPC_LARGESET_COMP_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  558. asm
  559. movl set1,%esi
  560. movl set2,%edi
  561. movl size,%ecx
  562. .LMCOMPSETSIZES1:
  563. lodsl
  564. movl (%edi),%edx
  565. cmpl %edx,%eax
  566. jne .LMCOMPSETSIZEEND
  567. addl $4,%edi
  568. decl %ecx
  569. jnz .LMCOMPSETSIZES1
  570. { we are here only if the two sets are equal
  571. we have zero flag set, and that what is expected }
  572. .LMCOMPSETSIZEEND:
  573. end;
  574. procedure fpc_largeset_contains_sets(set1,set2 : pointer; size: longint);assembler;[public,alias:'FPC_LARGESET_CONTAINS_SETS']; {$ifdef hascompilerproc} compilerproc; {$endif}
  575. {
  576. on exit, zero flag is set if set1 <= set2 (set2 contains set1)
  577. }
  578. asm
  579. movl set1,%esi
  580. movl set2,%edi
  581. movl size,%ecx
  582. .LMCONTAINSSETS2:
  583. movl (%esi),%eax
  584. movl (%edi),%edx
  585. andl %eax,%edx
  586. cmpl %edx,%eax {set1 and set2 = set1?}
  587. jne .LMCONTAINSSETEND2
  588. addl $4,%esi
  589. addl $4,%edi
  590. decl %ecx
  591. jnz .LMCONTAINSSETS2
  592. { we are here only if set2 contains set1
  593. we have zero flag set, and that what is expected }
  594. .LMCONTAINSSETEND2:
  595. end;
  596. {$endif LARGESET}
  597. {
  598. $Log$
  599. Revision 1.11 2003-09-08 18:21:37 peter
  600. * save edi,esi,ebx
  601. Revision 1.10 2003/05/26 19:36:46 peter
  602. * fpc_shortstr_concat is now the same for all targets
  603. * fpc_shortstr_append_shortstr added for optimized code generation
  604. Revision 1.9 2002/09/07 16:01:19 peter
  605. * old logs removed and tabs fixed
  606. Revision 1.8 2002/03/29 20:15:44 peter
  607. * fixed load_smallset
  608. }