pack_generic.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /* Generic implementation of the PACK intrinsic
  2. Copyright (C) 2002-2015 Free Software Foundation, Inc.
  3. Contributed by Paul Brook <paul@nowt.org>
  4. This file is part of the GNU Fortran runtime library (libgfortran).
  5. Libgfortran is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public
  7. License as published by the Free Software Foundation; either
  8. version 3 of the License, or (at your option) any later version.
  9. Ligbfortran is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License and
  17. a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. #include "libgfortran.h"
  21. #include <stdlib.h>
  22. #include <assert.h>
  23. #include <string.h>
  24. /* PACK is specified as follows:
  25. 13.14.80 PACK (ARRAY, MASK, [VECTOR])
  26. Description: Pack an array into an array of rank one under the
  27. control of a mask.
  28. Class: Transformational function.
  29. Arguments:
  30. ARRAY may be of any type. It shall not be scalar.
  31. MASK shall be of type LOGICAL. It shall be conformable with ARRAY.
  32. VECTOR (optional) shall be of the same type and type parameters
  33. as ARRAY. VECTOR shall have at least as many elements as
  34. there are true elements in MASK. If MASK is a scalar
  35. with the value true, VECTOR shall have at least as many
  36. elements as there are in ARRAY.
  37. Result Characteristics: The result is an array of rank one with the
  38. same type and type parameters as ARRAY. If VECTOR is present, the
  39. result size is that of VECTOR; otherwise, the result size is the
  40. number /t/ of true elements in MASK unless MASK is scalar with the
  41. value true, in which case the result size is the size of ARRAY.
  42. Result Value: Element /i/ of the result is the element of ARRAY
  43. that corresponds to the /i/th true element of MASK, taking elements
  44. in array element order, for /i/ = 1, 2, ..., /t/. If VECTOR is
  45. present and has size /n/ > /t/, element /i/ of the result has the
  46. value VECTOR(/i/), for /i/ = /t/ + 1, ..., /n/.
  47. Examples: The nonzero elements of an array M with the value
  48. | 0 0 0 |
  49. | 9 0 0 | may be "gathered" by the function PACK. The result of
  50. | 0 0 7 |
  51. PACK (M, MASK = M.NE.0) is [9,7] and the result of PACK (M, M.NE.0,
  52. VECTOR = (/ 2,4,6,8,10,12 /)) is [9,7,6,8,10,12].
  53. There are two variants of the PACK intrinsic: one, where MASK is
  54. array valued, and the other one where MASK is scalar. */
  55. static void
  56. pack_internal (gfc_array_char *ret, const gfc_array_char *array,
  57. const gfc_array_l1 *mask, const gfc_array_char *vector,
  58. index_type size)
  59. {
  60. /* r.* indicates the return array. */
  61. index_type rstride0;
  62. char * restrict rptr;
  63. /* s.* indicates the source array. */
  64. index_type sstride[GFC_MAX_DIMENSIONS];
  65. index_type sstride0;
  66. const char *sptr;
  67. /* m.* indicates the mask array. */
  68. index_type mstride[GFC_MAX_DIMENSIONS];
  69. index_type mstride0;
  70. const GFC_LOGICAL_1 *mptr;
  71. index_type count[GFC_MAX_DIMENSIONS];
  72. index_type extent[GFC_MAX_DIMENSIONS];
  73. index_type n;
  74. index_type dim;
  75. index_type nelem;
  76. index_type total;
  77. int mask_kind;
  78. dim = GFC_DESCRIPTOR_RANK (array);
  79. sptr = array->base_addr;
  80. mptr = mask->base_addr;
  81. /* Use the same loop for all logical types, by using GFC_LOGICAL_1
  82. and using shifting to address size and endian issues. */
  83. mask_kind = GFC_DESCRIPTOR_SIZE (mask);
  84. if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
  85. #ifdef HAVE_GFC_LOGICAL_16
  86. || mask_kind == 16
  87. #endif
  88. )
  89. {
  90. /* Don't convert a NULL pointer as we use test for NULL below. */
  91. if (mptr)
  92. mptr = GFOR_POINTER_TO_L1 (mptr, mask_kind);
  93. }
  94. else
  95. runtime_error ("Funny sized logical array");
  96. for (n = 0; n < dim; n++)
  97. {
  98. count[n] = 0;
  99. extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
  100. sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n);
  101. mstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(mask,n);
  102. }
  103. if (sstride[0] == 0)
  104. sstride[0] = size;
  105. if (mstride[0] == 0)
  106. mstride[0] = mask_kind;
  107. if (ret->base_addr == NULL || unlikely (compile_options.bounds_check))
  108. {
  109. /* Count the elements, either for allocating memory or
  110. for bounds checking. */
  111. if (vector != NULL)
  112. {
  113. /* The return array will have as many
  114. elements as there are in VECTOR. */
  115. total = GFC_DESCRIPTOR_EXTENT(vector,0);
  116. }
  117. else
  118. {
  119. /* We have to count the true elements in MASK. */
  120. total = count_0 (mask);
  121. }
  122. if (ret->base_addr == NULL)
  123. {
  124. /* Setup the array descriptor. */
  125. GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
  126. ret->offset = 0;
  127. /* xmallocarray allocates a single byte for zero size. */
  128. ret->base_addr = xmallocarray (total, size);
  129. if (total == 0)
  130. return; /* In this case, nothing remains to be done. */
  131. }
  132. else
  133. {
  134. /* We come here because of range checking. */
  135. index_type ret_extent;
  136. ret_extent = GFC_DESCRIPTOR_EXTENT(ret,0);
  137. if (total != ret_extent)
  138. runtime_error ("Incorrect extent in return value of PACK intrinsic;"
  139. " is %ld, should be %ld", (long int) total,
  140. (long int) ret_extent);
  141. }
  142. }
  143. rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0);
  144. if (rstride0 == 0)
  145. rstride0 = size;
  146. sstride0 = sstride[0];
  147. mstride0 = mstride[0];
  148. rptr = ret->base_addr;
  149. while (sptr && mptr)
  150. {
  151. /* Test this element. */
  152. if (*mptr)
  153. {
  154. /* Add it. */
  155. memcpy (rptr, sptr, size);
  156. rptr += rstride0;
  157. }
  158. /* Advance to the next element. */
  159. sptr += sstride0;
  160. mptr += mstride0;
  161. count[0]++;
  162. n = 0;
  163. while (count[n] == extent[n])
  164. {
  165. /* When we get to the end of a dimension, reset it and increment
  166. the next dimension. */
  167. count[n] = 0;
  168. /* We could precalculate these products, but this is a less
  169. frequently used path so probably not worth it. */
  170. sptr -= sstride[n] * extent[n];
  171. mptr -= mstride[n] * extent[n];
  172. n++;
  173. if (n >= dim)
  174. {
  175. /* Break out of the loop. */
  176. sptr = NULL;
  177. break;
  178. }
  179. else
  180. {
  181. count[n]++;
  182. sptr += sstride[n];
  183. mptr += mstride[n];
  184. }
  185. }
  186. }
  187. /* Add any remaining elements from VECTOR. */
  188. if (vector)
  189. {
  190. n = GFC_DESCRIPTOR_EXTENT(vector,0);
  191. nelem = ((rptr - ret->base_addr) / rstride0);
  192. if (n > nelem)
  193. {
  194. sstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0);
  195. if (sstride0 == 0)
  196. sstride0 = size;
  197. sptr = vector->base_addr + sstride0 * nelem;
  198. n -= nelem;
  199. while (n--)
  200. {
  201. memcpy (rptr, sptr, size);
  202. rptr += rstride0;
  203. sptr += sstride0;
  204. }
  205. }
  206. }
  207. }
  208. extern void pack (gfc_array_char *, const gfc_array_char *,
  209. const gfc_array_l1 *, const gfc_array_char *);
  210. export_proto(pack);
  211. void
  212. pack (gfc_array_char *ret, const gfc_array_char *array,
  213. const gfc_array_l1 *mask, const gfc_array_char *vector)
  214. {
  215. index_type type_size;
  216. index_type size;
  217. type_size = GFC_DTYPE_TYPE_SIZE(array);
  218. switch(type_size)
  219. {
  220. case GFC_DTYPE_LOGICAL_1:
  221. case GFC_DTYPE_INTEGER_1:
  222. case GFC_DTYPE_DERIVED_1:
  223. pack_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) array,
  224. (gfc_array_l1 *) mask, (gfc_array_i1 *) vector);
  225. return;
  226. case GFC_DTYPE_LOGICAL_2:
  227. case GFC_DTYPE_INTEGER_2:
  228. pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array,
  229. (gfc_array_l1 *) mask, (gfc_array_i2 *) vector);
  230. return;
  231. case GFC_DTYPE_LOGICAL_4:
  232. case GFC_DTYPE_INTEGER_4:
  233. pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array,
  234. (gfc_array_l1 *) mask, (gfc_array_i4 *) vector);
  235. return;
  236. case GFC_DTYPE_LOGICAL_8:
  237. case GFC_DTYPE_INTEGER_8:
  238. pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array,
  239. (gfc_array_l1 *) mask, (gfc_array_i8 *) vector);
  240. return;
  241. #ifdef HAVE_GFC_INTEGER_16
  242. case GFC_DTYPE_LOGICAL_16:
  243. case GFC_DTYPE_INTEGER_16:
  244. pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array,
  245. (gfc_array_l1 *) mask, (gfc_array_i16 *) vector);
  246. return;
  247. #endif
  248. case GFC_DTYPE_REAL_4:
  249. pack_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) array,
  250. (gfc_array_l1 *) mask, (gfc_array_r4 *) vector);
  251. return;
  252. case GFC_DTYPE_REAL_8:
  253. pack_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) array,
  254. (gfc_array_l1 *) mask, (gfc_array_r8 *) vector);
  255. return;
  256. /* FIXME: This here is a hack, which will have to be removed when
  257. the array descriptor is reworked. Currently, we don't store the
  258. kind value for the type, but only the size. Because on targets with
  259. __float128, we have sizeof(logn double) == sizeof(__float128),
  260. we cannot discriminate here and have to fall back to the generic
  261. handling (which is suboptimal). */
  262. #if !defined(GFC_REAL_16_IS_FLOAT128)
  263. # ifdef HAVE_GFC_REAL_10
  264. case GFC_DTYPE_REAL_10:
  265. pack_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) array,
  266. (gfc_array_l1 *) mask, (gfc_array_r10 *) vector);
  267. return;
  268. # endif
  269. # ifdef HAVE_GFC_REAL_16
  270. case GFC_DTYPE_REAL_16:
  271. pack_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) array,
  272. (gfc_array_l1 *) mask, (gfc_array_r16 *) vector);
  273. return;
  274. # endif
  275. #endif
  276. case GFC_DTYPE_COMPLEX_4:
  277. pack_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) array,
  278. (gfc_array_l1 *) mask, (gfc_array_c4 *) vector);
  279. return;
  280. case GFC_DTYPE_COMPLEX_8:
  281. pack_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array,
  282. (gfc_array_l1 *) mask, (gfc_array_c8 *) vector);
  283. return;
  284. /* FIXME: This here is a hack, which will have to be removed when
  285. the array descriptor is reworked. Currently, we don't store the
  286. kind value for the type, but only the size. Because on targets with
  287. __float128, we have sizeof(logn double) == sizeof(__float128),
  288. we cannot discriminate here and have to fall back to the generic
  289. handling (which is suboptimal). */
  290. #if !defined(GFC_REAL_16_IS_FLOAT128)
  291. # ifdef HAVE_GFC_COMPLEX_10
  292. case GFC_DTYPE_COMPLEX_10:
  293. pack_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) array,
  294. (gfc_array_l1 *) mask, (gfc_array_c10 *) vector);
  295. return;
  296. # endif
  297. # ifdef HAVE_GFC_COMPLEX_16
  298. case GFC_DTYPE_COMPLEX_16:
  299. pack_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) array,
  300. (gfc_array_l1 *) mask, (gfc_array_c16 *) vector);
  301. return;
  302. # endif
  303. #endif
  304. /* For derived types, let's check the actual alignment of the
  305. data pointers. If they are aligned, we can safely call
  306. the unpack functions. */
  307. case GFC_DTYPE_DERIVED_2:
  308. if (GFC_UNALIGNED_2(ret->base_addr) || GFC_UNALIGNED_2(array->base_addr)
  309. || (vector && GFC_UNALIGNED_2(vector->base_addr)))
  310. break;
  311. else
  312. {
  313. pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array,
  314. (gfc_array_l1 *) mask, (gfc_array_i2 *) vector);
  315. return;
  316. }
  317. case GFC_DTYPE_DERIVED_4:
  318. if (GFC_UNALIGNED_4(ret->base_addr) || GFC_UNALIGNED_4(array->base_addr)
  319. || (vector && GFC_UNALIGNED_4(vector->base_addr)))
  320. break;
  321. else
  322. {
  323. pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array,
  324. (gfc_array_l1 *) mask, (gfc_array_i4 *) vector);
  325. return;
  326. }
  327. case GFC_DTYPE_DERIVED_8:
  328. if (GFC_UNALIGNED_8(ret->base_addr) || GFC_UNALIGNED_8(array->base_addr)
  329. || (vector && GFC_UNALIGNED_8(vector->base_addr)))
  330. break;
  331. else
  332. {
  333. pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array,
  334. (gfc_array_l1 *) mask, (gfc_array_i8 *) vector);
  335. return;
  336. }
  337. #ifdef HAVE_GFC_INTEGER_16
  338. case GFC_DTYPE_DERIVED_16:
  339. if (GFC_UNALIGNED_16(ret->base_addr) || GFC_UNALIGNED_16(array->base_addr)
  340. || (vector && GFC_UNALIGNED_16(vector->base_addr)))
  341. break;
  342. else
  343. {
  344. pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array,
  345. (gfc_array_l1 *) mask, (gfc_array_i16 *) vector);
  346. return;
  347. }
  348. #endif
  349. }
  350. size = GFC_DESCRIPTOR_SIZE (array);
  351. pack_internal (ret, array, mask, vector, size);
  352. }
  353. extern void pack_char (gfc_array_char *, GFC_INTEGER_4, const gfc_array_char *,
  354. const gfc_array_l1 *, const gfc_array_char *,
  355. GFC_INTEGER_4, GFC_INTEGER_4);
  356. export_proto(pack_char);
  357. void
  358. pack_char (gfc_array_char *ret,
  359. GFC_INTEGER_4 ret_length __attribute__((unused)),
  360. const gfc_array_char *array, const gfc_array_l1 *mask,
  361. const gfc_array_char *vector, GFC_INTEGER_4 array_length,
  362. GFC_INTEGER_4 vector_length __attribute__((unused)))
  363. {
  364. pack_internal (ret, array, mask, vector, array_length);
  365. }
  366. extern void pack_char4 (gfc_array_char *, GFC_INTEGER_4, const gfc_array_char *,
  367. const gfc_array_l1 *, const gfc_array_char *,
  368. GFC_INTEGER_4, GFC_INTEGER_4);
  369. export_proto(pack_char4);
  370. void
  371. pack_char4 (gfc_array_char *ret,
  372. GFC_INTEGER_4 ret_length __attribute__((unused)),
  373. const gfc_array_char *array, const gfc_array_l1 *mask,
  374. const gfc_array_char *vector, GFC_INTEGER_4 array_length,
  375. GFC_INTEGER_4 vector_length __attribute__((unused)))
  376. {
  377. pack_internal (ret, array, mask, vector, array_length * sizeof (gfc_char4_t));
  378. }
  379. static void
  380. pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
  381. const GFC_LOGICAL_4 *mask, const gfc_array_char *vector,
  382. index_type size)
  383. {
  384. /* r.* indicates the return array. */
  385. index_type rstride0;
  386. char *rptr;
  387. /* s.* indicates the source array. */
  388. index_type sstride[GFC_MAX_DIMENSIONS];
  389. index_type sstride0;
  390. const char *sptr;
  391. index_type count[GFC_MAX_DIMENSIONS];
  392. index_type extent[GFC_MAX_DIMENSIONS];
  393. index_type n;
  394. index_type dim;
  395. index_type ssize;
  396. index_type nelem;
  397. index_type total;
  398. dim = GFC_DESCRIPTOR_RANK (array);
  399. /* Initialize sstride[0] to avoid -Wmaybe-uninitialized
  400. complaints. */
  401. sstride[0] = size;
  402. ssize = 1;
  403. for (n = 0; n < dim; n++)
  404. {
  405. count[n] = 0;
  406. extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
  407. if (extent[n] < 0)
  408. extent[n] = 0;
  409. sstride[n] = GFC_DESCRIPTOR_STRIDE_BYTES(array,n);
  410. ssize *= extent[n];
  411. }
  412. if (sstride[0] == 0)
  413. sstride[0] = size;
  414. sstride0 = sstride[0];
  415. if (ssize != 0)
  416. sptr = array->base_addr;
  417. else
  418. sptr = NULL;
  419. if (ret->base_addr == NULL)
  420. {
  421. /* Allocate the memory for the result. */
  422. if (vector != NULL)
  423. {
  424. /* The return array will have as many elements as there are
  425. in vector. */
  426. total = GFC_DESCRIPTOR_EXTENT(vector,0);
  427. if (total <= 0)
  428. {
  429. total = 0;
  430. vector = NULL;
  431. }
  432. }
  433. else
  434. {
  435. if (*mask)
  436. {
  437. /* The result array will have as many elements as the input
  438. array. */
  439. total = extent[0];
  440. for (n = 1; n < dim; n++)
  441. total *= extent[n];
  442. }
  443. else
  444. /* The result array will be empty. */
  445. total = 0;
  446. }
  447. /* Setup the array descriptor. */
  448. GFC_DIMENSION_SET(ret->dim[0],0,total-1,1);
  449. ret->offset = 0;
  450. ret->base_addr = xmallocarray (total, size);
  451. if (total == 0)
  452. return;
  453. }
  454. rstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(ret,0);
  455. if (rstride0 == 0)
  456. rstride0 = size;
  457. rptr = ret->base_addr;
  458. /* The remaining possibilities are now:
  459. If MASK is .TRUE., we have to copy the source array into the
  460. result array. We then have to fill it up with elements from VECTOR.
  461. If MASK is .FALSE., we have to copy VECTOR into the result
  462. array. If VECTOR were not present we would have already returned. */
  463. if (*mask && ssize != 0)
  464. {
  465. while (sptr)
  466. {
  467. /* Add this element. */
  468. memcpy (rptr, sptr, size);
  469. rptr += rstride0;
  470. /* Advance to the next element. */
  471. sptr += sstride0;
  472. count[0]++;
  473. n = 0;
  474. while (count[n] == extent[n])
  475. {
  476. /* When we get to the end of a dimension, reset it and
  477. increment the next dimension. */
  478. count[n] = 0;
  479. /* We could precalculate these products, but this is a
  480. less frequently used path so probably not worth it. */
  481. sptr -= sstride[n] * extent[n];
  482. n++;
  483. if (n >= dim)
  484. {
  485. /* Break out of the loop. */
  486. sptr = NULL;
  487. break;
  488. }
  489. else
  490. {
  491. count[n]++;
  492. sptr += sstride[n];
  493. }
  494. }
  495. }
  496. }
  497. /* Add any remaining elements from VECTOR. */
  498. if (vector)
  499. {
  500. n = GFC_DESCRIPTOR_EXTENT(vector,0);
  501. nelem = ((rptr - ret->base_addr) / rstride0);
  502. if (n > nelem)
  503. {
  504. sstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0);
  505. if (sstride0 == 0)
  506. sstride0 = size;
  507. sptr = vector->base_addr + sstride0 * nelem;
  508. n -= nelem;
  509. while (n--)
  510. {
  511. memcpy (rptr, sptr, size);
  512. rptr += rstride0;
  513. sptr += sstride0;
  514. }
  515. }
  516. }
  517. }
  518. extern void pack_s (gfc_array_char *ret, const gfc_array_char *array,
  519. const GFC_LOGICAL_4 *, const gfc_array_char *);
  520. export_proto(pack_s);
  521. void
  522. pack_s (gfc_array_char *ret, const gfc_array_char *array,
  523. const GFC_LOGICAL_4 *mask, const gfc_array_char *vector)
  524. {
  525. pack_s_internal (ret, array, mask, vector, GFC_DESCRIPTOR_SIZE (array));
  526. }
  527. extern void pack_s_char (gfc_array_char *ret, GFC_INTEGER_4,
  528. const gfc_array_char *array, const GFC_LOGICAL_4 *,
  529. const gfc_array_char *, GFC_INTEGER_4,
  530. GFC_INTEGER_4);
  531. export_proto(pack_s_char);
  532. void
  533. pack_s_char (gfc_array_char *ret,
  534. GFC_INTEGER_4 ret_length __attribute__((unused)),
  535. const gfc_array_char *array, const GFC_LOGICAL_4 *mask,
  536. const gfc_array_char *vector, GFC_INTEGER_4 array_length,
  537. GFC_INTEGER_4 vector_length __attribute__((unused)))
  538. {
  539. pack_s_internal (ret, array, mask, vector, array_length);
  540. }
  541. extern void pack_s_char4 (gfc_array_char *ret, GFC_INTEGER_4,
  542. const gfc_array_char *array, const GFC_LOGICAL_4 *,
  543. const gfc_array_char *, GFC_INTEGER_4,
  544. GFC_INTEGER_4);
  545. export_proto(pack_s_char4);
  546. void
  547. pack_s_char4 (gfc_array_char *ret,
  548. GFC_INTEGER_4 ret_length __attribute__((unused)),
  549. const gfc_array_char *array, const GFC_LOGICAL_4 *mask,
  550. const gfc_array_char *vector, GFC_INTEGER_4 array_length,
  551. GFC_INTEGER_4 vector_length __attribute__((unused)))
  552. {
  553. pack_s_internal (ret, array, mask, vector,
  554. array_length * sizeof (gfc_char4_t));
  555. }