⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitblt.c

📁 麻省理工开发的免费遗传算法类库GAlib,很好用
💻 C
字号:
/* Copyright (C) 1994 Free Software FoundationThis file is part of the GNU BitString Library.  This library is freesoftware; you can redistribute it and/or modify it under theterms of the GNU General Public License as published by theFree Software Foundation; either version 2, or (at your option)any later version.This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this library; see the file COPYING.  If not, write to the FreeSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.As a special exception, if you link this library with filescompiled with a GNU compiler to produce an executable, this does not causethe resulting executable to be covered by the GNU General Public License.This exception does not however invalidate any other reasons whythe executable file might be covered by the GNU General Public License. *//*  Written by Per Bothner (bothner@cygnus.com).    Based on ideas in the X11 MFB server. */#include "bitprims.h"#define ONES ((_BS_word)(~0))/* Copy LENGTH bits from (starting at SRCBIT) into pdst starting at DSTBIT.   This will work even if psrc & pdst overlap. */void/*_BS_blt (op, pdst, dstbit, psrc, srcbit, length)     enum _BS_alu op;     register _BS_word* pdst;     int dstbit;     register const _BS_word* psrc;     int srcbit;     _BS_size_t length;*/_BS_blt (enum _BS_alu op,	 register _BS_word* pdst,	 int dstbit,	 register const _BS_word* psrc,	 int srcbit,	 _BS_size_t length){  _BS_word ca1, cx1, ca2, cx2;  switch (op)    {    case _BS_alu_clear:      _BS_clear (pdst, dstbit, length);      return;    case _BS_alu_and:      _BS_and (pdst, dstbit, psrc, srcbit, length);      return;    case _BS_alu_andReverse:      ca1 = ONES; cx1 = 0; ca2 = ONES; cx2 = 0;      break;    case _BS_alu_copy:      _BS_copy (pdst, dstbit, psrc, srcbit, length);      return;    case _BS_alu_andInverted:      ca1 = ONES; cx1 = ONES; ca2 = 0; cx2 = 0;      break;    case _BS_alu_noop:      return;    case _BS_alu_xor:      _BS_xor (pdst, dstbit, psrc, srcbit, length);      return;    case _BS_alu_or:      ca1 = ONES; cx1 = ONES; ca2 = ONES; cx2 = 0;      break;    case _BS_alu_nor:      ca1 = ONES; cx1 = ONES; ca2 = ONES; cx2 = ONES;      break;    case_BS_alu_equiv:      ca1 = 0; cx1 = ONES; ca2 = ONES; cx2 = ONES;      break;    case _BS_alu_invert:      _BS_invert (pdst, dstbit, length);      return;    case _BS_alu_orReverse:      ca1 = ONES; cx1 = ONES; ca2 = 0; cx2 = ONES;      break;    case _BS_alu_copyInverted:      ca1 = 0; cx1 = 0; ca2 = ONES; cx2 = ONES;      break;    case _BS_alu_orInverted:      ca1 = ONES; cx1 = 0; ca2 = ONES; cx2 = ONES;      break;    case _BS_alu_nand:      ca1 = ONES; cx1 = 0; ca2 = 0; cx2 = ONES;      break;    case _BS_alu_set:      _BS_set (pdst, dstbit, length);      return;    }  {#define COMBINE(dst, src)  ((dst) & ((src) & ca1 ^ cx1) ^ ((src) & ca2 ^ cx2))#include "bitdo2.h"  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -