File:  [local] / rpl / src / operations_binaires.c
Revision 1.39: download - view: text, annotated - select for diffs - revision graph
Tue Feb 26 19:56:17 2013 UTC (11 years, 2 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_12, HEAD
Mise à jour des copyrights.

    1: /*
    2: ================================================================================
    3:   RPL/2 (R) version 4.1.12
    4:   Copyright (C) 1989-2013 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: 
   43:     unsigned long           i;
   44:     unsigned long           j;
   45: 
   46:     longueur_binaire = 1;
   47:     j = 1;
   48: 
   49:     for(i = 0; i < 6; i++)
   50:     {
   51:         longueur_binaire += (test_cfsf(s_etat_processus, 37 + i) == d_vrai)
   52:                 ? j : 0;
   53:         j *= 2;
   54:     }
   55: 
   56:     return(longueur_binaire);
   57: }
   58: 
   59: 
   60: /*
   61: ================================================================================
   62:   Routine renvoyant le masque sur les entiers binaires (longueur à tronquer)
   63: ================================================================================
   64:   Entrées : structure sur l'état du processus
   65: --------------------------------------------------------------------------------
   66:   Sorties : masque
   67: --------------------------------------------------------------------------------
   68:   Effets de bord : néant
   69: ================================================================================
   70: */
   71: 
   72: logical8
   73: masque_entiers_binaires(struct_processus *s_etat_processus)
   74: {
   75:     unsigned char               i;
   76:     unsigned char               longueur;
   77: 
   78:     logical8                    masque;
   79: 
   80:     longueur = longueur_entiers_binaires(s_etat_processus);
   81:     masque = 0;
   82: 
   83:     for(i = 0; i < longueur; i++)
   84:     {
   85:         masque |= (((logical8) 1) << i);
   86:     }
   87: 
   88:     return(masque);
   89: }
   90: 
   91: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>