1: /*
2: ================================================================================
3: RPL/2 (R) version 4.1.36
4: Copyright (C) 1989-2025 Dr. BERTRAND Joël
5:
6: This file is part of RPL/2.
7:
8: RPL/2 is free software; you can redistribute it and/or modify it
9: under the terms of the CeCILL V2 License as published by the french
10: CEA, CNRS and INRIA.
11:
12: RPL/2 is distributed in the hope that it will be useful, but WITHOUT
13: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14: FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License
15: for more details.
16:
17: You should have received a copy of the CeCILL License
18: along with RPL/2. If not, write to info@cecill.info.
19: ================================================================================
20: */
21:
22:
23: #include "rpl-conv.h"
24:
25:
26: /*
27: ================================================================================
28: Routine renvoyant la longueur courante des entiers binaires
29: ================================================================================
30: Entrées : structure sur l'état du processus
31: --------------------------------------------------------------------------------
32: Sorties : longueur
33: --------------------------------------------------------------------------------
34: Effets de bord : néant
35: ================================================================================
36: */
37:
38: unsigned char
39: longueur_entiers_binaires(struct_processus *s_etat_processus)
40: {
41: unsigned char longueur_binaire;
42: unsigned char i;
43: unsigned char j;
44:
45: longueur_binaire = 1;
46: j = 0x01;
47:
48: for(i = 0; i < 6; i++)
49: {
50: if (test_cfsf(s_etat_processus, (unsigned char) (37 + i)) == d_vrai)
51: {
52: longueur_binaire = (unsigned char) (longueur_binaire + j);
53: }
54:
55: j = (unsigned char) (j << 1);
56: }
57:
58: return(longueur_binaire);
59: }
60:
61:
62: /*
63: ================================================================================
64: Routine renvoyant le masque sur les entiers binaires (longueur à tronquer)
65: ================================================================================
66: Entrées : structure sur l'état du processus
67: --------------------------------------------------------------------------------
68: Sorties : masque
69: --------------------------------------------------------------------------------
70: Effets de bord : néant
71: ================================================================================
72: */
73:
74: logical8
75: masque_entiers_binaires(struct_processus *s_etat_processus)
76: {
77: unsigned char i;
78: unsigned char longueur;
79:
80: logical8 masque;
81:
82: longueur = longueur_entiers_binaires(s_etat_processus);
83: masque = 0;
84:
85: for(i = 0; i < longueur; i++)
86: {
87: masque |= (((logical8) 1) << i);
88: }
89:
90: return(masque);
91: }
92:
93: // vim: ts=4
CVSweb interface <joel.bertrand@systella.fr>