بیت فیلد: تفاوت میان نسخه‌ها

محتوای حذف‌شده محتوای افزوده‌شده
اصلاح رده
←‏زبان برنامه‌نویسی سی: ترجمه کامنت‌ها به فارسی
خط ۱۵:
تعریف یک بیت فیلد در زبان سی
<source lang="c">
// opaqueمات andو showشفاف
#define YES 1
#define NO 0
 
// سبک خط‌ها
// line styles
#define SOLID 1
#define DOTTED 2
#define DASHED 3
 
// رنگ‌های اولیه
// primary colors
#define BLUE 4 /* 100 */
#define GREEN 2 /* 010 */
#define RED 1 /* 001 */
 
// رنگ‌های مخلوط
// mixed colors
#define BLACK 0 /* 000 */
#define YELLOW (RED | GREEN) /* 011 */
خط ۳۸:
const char * colors[8] = {"Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White"};
 
// مشخصات جعبه بیت فیلد
// bit field box properties
struct box_props
{
unsigned int opaque : 1;
unsigned int fill_color : 3;
unsigned int : 4; // fillپرکردن toتا 8۸ bitsبیت
unsigned int show_border : 1;
unsigned int border_color : 3;
unsigned int border_style : 2;
unsigned char : 0; // fillپرکردن toتا nearestنزدیک byteترین بایت (16۱۶ bitsبیت)
unsigned char width : 4, // Splitتقسیم aیک byteبایت intoبه 2دو fieldsفیلد of۴ 4 bitsبیتی
height : 4;
};
</source>
 
== منابع ==
{{پانویس}}