Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/prelude/Binary/SkipBits.gc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


module NHC.Binary
  ( skipBits
  ) where

import NHC.GreenCard
import BinHandle ({-type-}BinHandle(..))

%-#include "cLowBinary.h"

%fun skipBits :: BinHandle -> Int -> IO ()
%call (binHandle bh) (int width)
%code
%  while (width > 0) {
%    int avail = (CACHESIZE*8) - bh->cptr;
%    if (width >= avail) {
%      width    -= avail;
%      nextcache(bh);
%    } else {
%      bh->cptr += width;
%      width     = 0;
%    }
%  }
%result ()


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.