static void fill_video_alignment (GstVaapiVideoBufferPool * pool, GstVideoAlignment * align) { GstVideoInfo *const vip = &pool->priv->vmeta_vinfo; guint i; gst_video_alignment_reset (align); for (i = 0; i < GST_VIDEO_INFO_N_PLANES (vip); i++) align->stride_align[i] = (1U << g_bit_nth_lsf (GST_VIDEO_INFO_PLANE_STRIDE (vip, i), 0)) - 1; }
static int chassis_log_write(chassis_log *log, int log_level, GString *str) { if (-1 != log->log_file_fd) { /* prepend a timestamp */ if (-1 == write(log->log_file_fd, S(str))) { /* writing to the file failed (Disk Full, what ever ... */ write(STDERR_FILENO, S(str)); write(STDERR_FILENO, "\n", 1); } else { write(log->log_file_fd, "\n", 1); } #ifdef HAVE_SYSLOG_H } else if (log->use_syslog) { int log_index = g_bit_nth_lsf(log_level & G_LOG_LEVEL_MASK, -1) - G_LOG_ERROR_POSITION; syslog(log_lvl_map[log_index].syslog_lvl, "%s", str->str); #endif #ifdef _WIN32 } else if (log->use_windows_applog && log->event_source_handle) { char *log_messages[1]; int log_index = g_bit_nth_lsf(log_level & G_LOG_LEVEL_MASK, -1) - G_LOG_ERROR_POSITION; log_messages[0] = str->str; ReportEvent(log->event_source_handle, log_lvl_map[log_index].win_evtype, 0, /* category, we don't have that yet */ log_lvl_map[log_index].win_evtype, /* event indentifier, one of MSG_ERROR (0x01), MSG_WARNING(0x02), MSG_INFO(0x04) */ NULL, 1, /* number of strings to be substituted */ 0, /* no event specific data */ log_messages, /* the actual log message, always the message we came up with, we don't localize using Windows message files*/ NULL); #endif } else { write(STDERR_FILENO, S(str)); write(STDERR_FILENO, "\n", 1); } return 0; }
static guint8 fix_expected_colour (guint32 col_mask, guint8 col_expected) { guint32 mask; gint last = g_bit_nth_msf (col_mask, -1); gint first = g_bit_nth_lsf (col_mask, -1); mask = 1 << (last - first + 1); mask -= 1; g_assert (col_expected == 0x00 || col_expected == 0xff); /* this only works because we only check for all-bits-set or no-bits-set */ return col_expected & mask; }
void swfdec_event_list_parse (SwfdecEventList *list, SwfdecBits *bits, int version, guint conditions, guint8 key, const char *description) { SwfdecEvent event; char *name; guint i; g_return_if_fail (list != NULL); g_return_if_fail (list->refcount == 1); g_return_if_fail (description != NULL); event.conditions = conditions & SWFDEC_EVENT_MASK; event.key = key; i = g_bit_nth_lsf (conditions, -1); name = g_strconcat (description, ".", i < N_CONDITIONS ? swfdec_event_type_get_name (i) : "???", NULL); event.script = swfdec_script_new_from_bits (bits, name, version); g_free (name); if (event.script) g_array_append_val (list->events, event); }
static VALUE rg_s_bit_nth_lsf(G_GNUC_UNUSED VALUE self, VALUE mask, VALUE nth_bit) { return INT2NUM(g_bit_nth_lsf(NUM2ULONG(mask), NUM2INT(nth_bit))); }